How to use Button array?
i want to use separate code for each button, Please Help

In VB6.0, to easily create an array of command buttons, or any control for that matter, place a command button on the form, name it, and set whatever other properties you want. Then select the command button on the form in the design environment and just like you would copy and paste some text, press CTRL+C and CTRL+V. Answer yes to the msgbox and continue for as many buttons as you want.

Now, for accessing the code window, double click on one of the buttons and the code pane will come up and you should see something like...

Private Sub Command1_Click(Index As Integer)

End Sub

From there you could use either a select case statement to tell the difference between which button was pushed, like so...

Select Case Index
Case 0 'first button (could be move first if coding for recordset navigation)
Case 1 'second button (move previous (recordset naviation))
Case 2 '(Move next in reference to recordset navigation)
Case 3 '(Move last...)
End Select

Or you could use the if elseif structure...

If Index = 0 Then
ElseIf Index =1 Then
'...

Good Luck

Ok, I understand now
Thanks for help


Solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.