1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
private void BoutonAjouter_Click(object sender, EventArgs e)
{
try
{
int tampon;
int ajout = ComboBox.Items.Add(int.Parse(ComboBox.Text));
for (int i = 0; i < (ComboBox.Items.Count) - 1; i++)
{
int value = int.Parse(ComboBox.GetItemText(ComboBox.Items[i]));
int value1 = int.Parse(ComboBox.GetItemText(ComboBox.Items[i+1]));
if(value > value1)
{
tampon = value;
value = value1;
value1 = tampon;
}
}
}
catch( FormatException a)
{
DialogResult Reponse;
Reponse = MessageBox.Show("Entrer un nombre svp ???", "Attention", MessageBoxButtons.RetryCancel);
}
} |
Partager