cs_jeanlucsl
Messages postés16Date d'inscriptionvendredi 21 janvier 2005StatutMembreDernière intervention18 février 2005
-
18 févr. 2005 à 19:17
Gobillot
Messages postés3140Date d'inscriptionvendredi 14 mai 2004StatutMembreDernière intervention11 mars 2019
-
18 févr. 2005 à 20:34
salut a tous
j'ai un message d'erreur "Un objet est requis"
est-ce que quelqu'un peut m'aider
code form1
Dim ligne(1 To 5) As String
Public test1, test2, test3, test4, Nbr_Combo As String
Public Sub Command1_Click()If check1.Value 0 Then test1 "Tant Pis" Else test1 = "Coucou"If check2.Value 0 Then test2 "A bientot" Else test2 = "Bonjour"If check3.Value 0 Then test3 "" Else test3 = "Ce n'est qu'un exemple"If Form2.check4.Value 0 Then test4 "" Else test4 = "Ca marche"
Nbr_Combo = Combo1.txt
P1 = ""
For i = 1 To Nbr_Combo
P1 = P1 + "\driver" + i
Next i
ligne(1) = "check1" & test1
ligne(2) = "check2" & test2
ligne(3) = "check3" & test3
ligne(4) = "check4" & test4
ligne(5) = "\test" & Nbr_Combo
test = FreeFile
Open "test.txt" For Output As #test
For i = 1 To 6
Print #test, ligne(i)
Next i
Close #test
End Sub
Private Sub Command2_Click()
Form2.Show
Form1.Hide
End Sub
Private Sub Form_Load()
Form2.Combo1.AddItem "1"
Form2.Combo1.AddItem "2"
End Sub
code form2:
Dim ligne(1 To 5) As String
Private Sub Appliquer_Click()
Call Form1.Command1_Click
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Form1.Show
Form2.Hide
End Sub
Gobillot
Messages postés3140Date d'inscriptionvendredi 14 mai 2004StatutMembreDernière intervention11 mars 201934 18 févr. 2005 à 20:34
il faut déclarer les zones séparément (si VB6):
Public test1 As String, test2 As String, test3 As String, test4 As String
(pourquoi Public ?)
pour un compteur, vaut mieux le mettre en numérique:
Dim Nbr_Combo As Integer
dans Form1 toujours mettre le nom de la Form si l'objet se trouve dans une autre Forme:
Nbr_Combo = Form2.Combo1.Text
(même si Nbr_Combo est numérique VB fera la conversion)