Label dynamique ( avec combobox )
Bonjour à tous,
Je suis débutant en C#, et je voulais savoir comment créer un label dynamique en fonction du choix d'un combobox.
Voici le code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| // comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Items.AddRange(new object[] {
"choix1",
"choix2"});
this.comboBox1.Location = new System.Drawing.Point(222, 87);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 21);
this.comboBox1.TabIndex = 4;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(222, 115);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(0, 13);
this.label5.TabIndex = 5;
this.label5.Text = this.comboBox1.Text;
this.label5.Click += new System.EventHandler(this.label5_Click); |
Si je ne m'abuse la partie en gras est bien celle sur laquelle il faut travailler, seulement quand je fais ça, rien ne s'affiche dans mon label.Quelqu'un aurait une idée?
Merci d'avance.
Horn33t