System.NullReferenceException Error !
Bonjour;
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| {
public RadioButton[] radios = new RadioButton[max_autos + 1]; // tableau des boutons radio
// Initialisation du tableau des boutons radio
for (int x = 1; x <= max_autos; x++)
{
radios[x] = new RadioButton();
topPanel.Controls.Add(radios[x]);
radios[x].AutoSize = true;
radios[x].Location = new Point(3 + (x - 1) * (topPanel.Width / max_autos), 0);
radios[x].Font = new Font("Tahoma", 8F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
...
}
.....
radios[auto_courant].Text = textBox1.Text;*****
...
} |
J'essaye ci dessus de créer des boutons radios a travers le code qui sont implémentés dans un tableau sur un Panel(topPanel) , mais je ne sais pas pourquoi ça ne marche pas
System.NullReferenceException est affiché a chaque fois....
????
Merci pour votre aide