Solved

Control Array

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…
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…

809 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