usetheforce2
09-14-2000, 06:54 PM
two questions
how can i create a control array (say of command buttons) at run time. the following code will produce two command buttons, however it is not a control array.
Option Explicit
Dim MyControl As CommandButton
Private Sub Form_Load()
Dim i As Integer
For i = 1 To 2
Set MyControl = Form1.Controls.Add("vb.commandbutton", "command" & i)
MyControl.Visible = True
If i = 2 Then
MyControl.Left = MyControl.Width + 100
End If
Next
End Sub
this will create "Command1" and "Command2" side by side: what i want to be able to do is have and array of command buttons such as :
Command(1)'indexs
Command(2)'indexs
my second question, when i create these to controls how can i enter a sub. such as :
Private sub Command()_click(index as integer)
thanks in advance for any Help!
Regan DeDiana
how can i create a control array (say of command buttons) at run time. the following code will produce two command buttons, however it is not a control array.
Option Explicit
Dim MyControl As CommandButton
Private Sub Form_Load()
Dim i As Integer
For i = 1 To 2
Set MyControl = Form1.Controls.Add("vb.commandbutton", "command" & i)
MyControl.Visible = True
If i = 2 Then
MyControl.Left = MyControl.Width + 100
End If
Next
End Sub
this will create "Command1" and "Command2" side by side: what i want to be able to do is have and array of command buttons such as :
Command(1)'indexs
Command(2)'indexs
my second question, when i create these to controls how can i enter a sub. such as :
Private sub Command()_click(index as integer)
thanks in advance for any Help!
Regan DeDiana