Solved

Control Array

Posted on 2000-04-30
3
148 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

760 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

20 Experts available now in Live!

Get 1:1 Help Now