lier des boutonsdonc peux tu expliquer ce que tu veux faire plus précisément.
je ne retrouve pas mes repaires
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPublic Class SuperButton
Inherits Button
Private _Index As Integer
Public Property Index As Integer
Get
Dim g As String = Me.Name
_Index = CInt(Val(g(g.Count - 1)))
Return _Index
End Get
Set(value As Integer)
_Index = value
End Set
End Property
End Class
monControle(1).Caption = "Coucou".
Public Class Form1 Dim cLeft As Integer = 1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click AddNewButton() End Sub Public Function AddNewButton() As System.Windows.Forms.Button Dim btn As New System.Windows.Forms.Button() Me.Controls.Add(btn) btn.Top = cLeft * 25 btn.Left = 100 btn.Text = "Button " & Me.cLeft.ToString btn.TabIndex = CInt(Me.cLeft.ToString - 1) cLeft = cLeft + 1 AddHandler btn.Click, AddressOf Button_DoubleClick Return btn End Function Private Sub Button_DoubleClick(sender As System.Object, e As System.EventArgs) ' On récupère le contrôle cliqué ... Dim textTmp As Button = DirectCast(sender, Button) MsgBox("Index " & textTmp.TabIndex) MsgBox("Bouton cliqué " & textTmp.Text) End Sub End Class