Explaning this WindowsFormAplication: I have two buttons one is for inserting numbers in listbox1 with textbox and that works fine ,second button is for sorting the elements from listbox1(numbers) as int or array to listbox2.It needs to be int or array because if i sort it as string then if i have for example 3,2,10 as my elements in listbox its going to sort it as 10,2,3 because its string, Now i have this code in my sort button where i made list from listbox elements and sorted it as string and dont know how to convert the list to array or int:
private void button2_Click(object sender, EventArgs e)
{
List<String> lista = new List<string>();
foreach (String x in listBox1.Items)
{
lista.Add(x);
}
lista.Sort();
foreach (string a in lista)
{
listBox2.Items.Add(a);
}
}