Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Index count of an activex ctl?

Status
Not open for further replies.

STtech

MIS
Oct 30, 2003
3
US
I am a newbie trying to learn the basics of active x. Heres what I created
1 button (active x control),5 command buttons in the control
once I place the control on a form I simply want to get back a small array with 2 things.
1- the index of the command button I clicked in the control (which I can get)
2- The index number of the INSTANCE of the control.
This is where I m stuck!!!!!!!!!!!!!!!
ex: callbutton (thecontrolsindex#),(Theindexofthecommandbutton)
How do I get the index of the usercontrol on a form from within the control itself?
I can count them with .count, and label them by calling cmdbtn(0).caption, from the form, but I cannot seem to get the index of the instance on the form.
What am I missing?
 
If you have an array of command buttons, such as cmd(0), cmd(1) and cmd(2) then on the click event of the button you can grab the index and run your code for that button/index, like this:

Private Sub cmb_Click(Index as Long)
Select Case Index
Case 0
'Insert cmd(0) code here
Case 1
'Insert cmd(1) code here
Case 2
'Insert cmd(2) code here
End Select
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top