C'est assez problématique car j'aimerais travailler avec la valeur de i après dans des tableaux, et ça fait planter mon programme si i vaut 3 (problèmes d'index)
For i = 0 To 2 For j = 0 To 2 If ligne(i, j) = firstClicked.Text Then Exit For End If Next If ligne(i, j) = firstClicked.Text Then depart(0) = i depart(1) = j Exit For End If Next
For i = 0 To 2 For j = 0 To 2 If ligne(i, j) = firstClicked.Text Then i = i + 1 : Exit For End If Next If ligne(i, j) = firstClicked.Text Then depart(0) = i depart(1) = j Exit For End If Next i = i -1 msgbox i
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questiondoit trouver les indices i et j dans le tableau "ligne" qui correspondent au bouton.
Public TABLEAU(,) As String = {{"Bouton 1","Bouton 3","Bouton 5"},{"Bouton 2","Bouton 3","Bouton 4"}}
Private Sub cmd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1,btn2,btn3,btn4,btn5 Dim clickedButton As Button = TryCast(sender, Button)