Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Control Array

Posted on 2000-04-30
3
Medium Priority
?
157 Views
Last Modified: 2010-05-02
Consider a control array of command buttons.  Since all elements of a control array have the same name, how can the programmer determine which button has been clicked?

Thanks,

Jairo Cardenas
0
Comment
Question by:jcardenas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 30 total points
ID: 2764264
you determine it by the control's index number

Command1(0)
Command1(1)
Command1(2)


when you only have 1 command button on a form its events look like this:

Private Sub Command1_Click()
   'some code
End Sub


when its in a control array it looks like this:


Private Sub Command1_Click(Index As Integer)
   'some code
End Sub



notice the new 'index' parameter.  this parameter tells you which command button was pressed by using Command1(Index)
0
 
LVL 6

Expert Comment

by:Marine
ID: 2764267
azrasound gave an answer
If you want to know what button was clicked you can do that
command1_Click(Index as Integer)

SElect Case Index
   case 0
   case 1
   case 2
   and so on.
end select
0
 

Author Comment

by:jcardenas
ID: 2764452
Thanks friends,


Jairo
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question