Question

Locked

create multiple command buttons dring run time in VB6.0

By hetal_2112 ·
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......

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Load function

by hespinos In reply to create multiple command b ...

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

Back to Software Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums