?
Solved

Control Array

Posted on 2000-04-30
3
Medium Priority
?
156 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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
Course of the Month11 days, 4 hours left to enroll

770 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