OVH Cloud OVH Cloud

créer dynamiquement en vb6

1 réponse
Avatar
Rombeau Jonathan
Bonjour à tous j'essaye de créer dynamiquement des textbox mais cela ne
fonctionne pas j'ai une erreur pourriez-vous m'aider ???

Dim cpt_int As Integer
cpt_int = 1
Do While Not RS.EOF
Form11.Controls.Add "VB.textbox", "text" & cpt_int, Form11

With Form11!(Text & cpt_int) => ERREUR !!!!
.Visible = True
.Width = 500
.Caption = cpt
End With
cpt_int = cpt_int + 1
RS.MoveNext
Loop

1 réponse

Avatar
Rombeau Jonathan
OK j'ai eu la solution

Dim NewTextBox As TextBox
Set NewTextBox = Form11.Controls.Add("VB.textbox", "text" & cpt_int, Form11)
With NewTextBox
.Visible = True
.Width = 500
.text = cpt
End With

"Rombeau Jonathan" a écrit dans le message de news:
e81a%
Bonjour à tous j'essaye de créer dynamiquement des textbox mais cela ne
fonctionne pas j'ai une erreur pourriez-vous m'aider ???

Dim cpt_int As Integer
cpt_int = 1
Do While Not RS.EOF
Form11.Controls.Add "VB.textbox", "text" & cpt_int, Form11

With Form11!(Text & cpt_int) => ERREUR !!!!
.Visible = True
.Width = 500
.Caption = cpt
End With
cpt_int = cpt_int + 1
RS.MoveNext
Loop