Solved

Control Array

Posted on 2000-04-30
3
149 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
3 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 10 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now