Results 1 to 2 of 2

Thread: control array index property

  1. #1
    M&S Farrell
    Guest

    Talking 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

  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    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
  •  



Click Here to Expand Forum to Full Width