Leo_Robotic_Passion
Messages postés135Date d'inscriptiondimanche 19 novembre 2000StatutMembreDernière intervention 2 décembre 2011
-
26 nov. 2007 à 00:29
Leo_Robotic_Passion
Messages postés135Date d'inscriptiondimanche 19 novembre 2000StatutMembreDernière intervention 2 décembre 2011
-
26 nov. 2007 à 02:27
Bonsoir a tous,
Dans mon code ci-dessous j’appel des boutons « Cbt », des textbox « Txt » et des frames « Fra_Txt ».
Private Sub Cbt_Click(Index As Integer)
Dim i As Long
Dim reponse As String
Dim Sans_Texte, Avec_Texte, Sans_Caption, Avec_Caption As Integer
Sans_Texte = 0
Avec_Texte = 0
Sans_Caption = 0
Avec_Caption = 0
For i = 0 To 8
If Trim$(Txt(i).Text) = "" Then
Sans_Texte = Sans_Texte + 1
Else
Avec_Texte = Avec_Texte + 1
End If
If Trim$(Cbt(i).Caption) = "" Then
Sans_Caption = Sans_Caption + 1
Else
Avec_Caption = Avec_Caption + 1
End If
If Sans_Caption = 0 Then
If Sans_Texte = 0 Then
AfUrbiSock_Cli.SocketSendData (Txt(i).Text)
Else
MsgBox "Aucune chaîne à envoyer"
Fra_Txt(i).Visible = True
Fra_Txt(i).Caption = Cbt(i).Caption
End If
Else
(i).Visible = False
reponse = InputBox("Entrez le nom du bouton:")
Cbt(i).Caption = reponse
End If
Next
End Sub
Quand je clique sur un de mes boutons j’aimerais que seulement l’InputBox("Entrez le nom du bouton:") de ce bouton s’ouvre.
De même pour le message box qu’il s’ouvre seulement dans le cas ou je clique sur le bouton Cbt(0) et que Txt(0) soit vide par exemple
Idem pour le SocketSendData, que le contenue de Txt(0) soit envoyer seulement si je clique sur le bouton Cbt(0) et pas sur un autre.
Mes contrôles sont indexés de cette façon :
Cbt(0) a Cbt(8)
Txt(0) a Txt(8)
Fra_Txt (0) a « Fra_Txt (8)
Et si tu supprimes la ligne For i = 0 to 8 et la ligne Next et remplaces tes indices (i) par (index) qu'est-ce que cela donne ?
Attention il manque le nom du controle sur une ligne ( voir lesmajuscules)
Private Sub Cbt_Click(Index As Integer)
Dim reponse As String
Dim Sans_Texte, Avec_Texte, Sans_Caption, Avec_Caption As Integer
Sans_Texte = 0
Avec_Texte = 0
Sans_Caption = 0
Avec_Caption = 0
If Trim$(Txt(index).Text) = "" Then
Sans_Texte = Sans_Texte + 1
Else
Avec_Texte = Avec_Texte + 1
End If
If Trim$(Cbt(index).Caption) = "" Then
Sans_Caption = Sans_Caption + 1
Else
Avec_Caption = Avec_Caption + 1
End If
If Sans_Caption = 0 Then
If Sans_Texte = 0 Then
AfUrbiSock_Cli.SocketSendData (Txt(index).Text)
Else
MsgBox "Aucune chaîne à envoyer"
Fra_Txt(index).Visible = True
Fra_Txt(index).Caption = Cbt(index).Caption
End If
Else
(index).Visible = False ''''' IL MANQUE LE NOM DU CONTROLE DEVANT (index).visible
reponse = InputBox("Entrez le nom du bouton:")
Cbt(index).Caption = reponse
End If