Withevents non supporta gli array di controlli.
Allora devi
1) Inserire nel form un commandbutton (che si chiamera' Command1), renderlo invisibile e assegnare il valore 0 al suo Index
2) quindi puoi usare il seguente codice d'esempio
codice:Private Sub Command1_Click(Index As Integer) MsgBox "tasto : " & Index End Sub Private Sub Form_Load() Dim i As Integer For i = 1 To 10 Load Command1(i) Command1(i).Left = 100 + i * 200 Command1(i).Top = 100 + i * 800 Command1(i).Caption = "tasto : " & i Command1(i).Visible = True Next i End Sub

Rispondi quotando