|
-
May 28th, 2002, 06:06 PM
#1
control array index property
I have an assignment that has a control array of command buttons representing the seating plan of an aeroplane. How do I reference the index property of the control array from another form that is displayed once the command button is pressed?
I need this index property so I can calculate the position of the command button to store information in a corresponding 2D array. The control array is 4 cols by 8 rows. I know I have to use row=IndexNumber \ 4+1 and col=IndexNumber MOD 4+1. Any help appreciated. Sandra
-
May 28th, 2002, 06:15 PM
#2
Fanatic Member
If I understand correctly, you are just needing to be able to pass the index of the button that was pressed to another form... This being the case, you should setup a public variable in a module and pass the index value that way. Here's how I'd do it (You'll need a Module and 2 forms. Form1 should have a command button control array called "cmdBtn". While Form2 should have a textbox called "Text1")
Module:
Code:
Public iIndex As Integer
Form1:
Code:
Private Sub cmdBtn_Click(Index As Integer)
iIndex = Index
Form2.Show
End Sub
Form2:
Code:
Private Sub Form_Load()
Text1.Text = iIndex
End Sub
www.RealisticGraphics.net
Running VS.Net Enterprise & VB 6
Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML
MSN Messenger: kmsheff
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|