Private Sub RadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim rb As RadioButton = DirectCast(sender, RadioButton) If rb.Checked Then MessageBox.Show(String.Format("{0} est sélectionné",rb.Name)) End Sub
Dim RB_Soft(0 To 20) As RadioButton For Cpt = 0 to 10 RB_Soft(Cpt).Parent = MaGroupBox RB_Soft(Cpt).Text = "Contrôle n°" & Cpt RB_Soft(Cpt).Top = Haut + RB_Soft(0).Height * Cpt RB_Soft(Cpt).Left = Gauche RB_Soft(Cpt).Visible = True AddHandler RB_Soft(Cpt).CheckedChanged, AddressOf RadioButton_CheckedChanged End If Exit For
For Cpt = 0 to 10 RemoveHandler RB_Soft(Cpt).CheckedChanged, AddressOf RadioButton_CheckedChanged RB_Soft(Cpt).Dispose Next
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDim RB_Soft(0 To 20) As RadioButton ' Try For Cpt = 0 To 10 RB_Soft(Cpt).Parent = GroupBox1 'l'exécution bug sur cette ligne RB_Soft(Cpt).Text = "Contrôle n°" & Cpt RB_Soft(Cpt).Top = 100 + RB_Soft(0).Height * Cpt RB_Soft(Cpt).Left = 50 RB_Soft(Cpt).Visible = True 'AddHandler RB_Soft(Cpt).CheckedChanged, AddressOf RadioButton1_CheckedChanged Cpt += 1 Next
Dim RB_Soft(0 To 20) As RadioButton ' Try For Cpt = 0 To 10 RB_Soft(Cpt) = New RadioButton ' <= Ligne a ajouter ! RB_Soft(Cpt).Parent = GroupBox1 'l'exécution bug sur cette ligne RB_Soft(Cpt).Text = "Contrôle n°" & Cpt RB_Soft(Cpt).Top = 100 + RB_Soft(0).Height * Cpt RB_Soft(Cpt).Left = 50 RB_Soft(Cpt).Visible = True 'AddHandler RB_Soft(Cpt).CheckedChanged, AddressOf RadioButton1_CheckedChanged Cpt += 1 Next
RB_Soft(Cpt) = New RadioButton ' <= Ligne a ajouter !