Question Locked

create multiple command buttons dring run time in VB6.0

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

i want to create a aaray and store it in access database how to do that.....
??????????????
how should i create multiple command buttons during run time on a vb form by using a array ....
plsssssssssss help me......

2 replies

by hespinos

you can use Load function, create de first command button in design time as an array with index 0 and then

load command1(newindex)

then make it visible.

Option Explicit

Private numControles As Long

Private Sub cmdCrear_Click()
numControles = numControles + 1
Load Label1(numControles)
Load Text1(numControles)

With Label1(numControles)
.Visible = True
.Top = Label1(numControles - 1).Top + .Height + 120
.Caption = "Label1(" & numControles & ")"
End With
With Text1(numControles)
.Visible = True
.Top = Text1(numControles - 1).Top + .Height + 60
.Text = "Text1(" & numControles & ")"
End With
End Sub

Private Sub cmdEliminar_Click()

If numControles > 0 Then
Unload Label1(numControles)
Unload Text1(numControles)
numControles = numControles - 1
End If
End Sub

Private Sub Form_Load()
cmdCrear_Click
End Sub

This discussion is closed to new replies.