Results 1 to 4 of 4

Thread: control array help

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Hi,

    I have a form with a control array of 2 ListViews.

    On the form, I have 1 command button that I would like a MsgBox to pop
    up to tell the user which item they selected..

    Problem is, how do I know which listview the user has clicked on. The only
    code I would come up with was:

    Code:
    Private Sub Command1_Click()
    
        MsgBox "You selected: " & ListView1(0).SelectedItem
            
    End Sub
    But as you can tell from the code, it only recognized the first control array and not
    the other array.

    Question is, how can I tell which control array the user clicked on so I can substitute
    the (0) with the appropriate array number..

    Thanks,

    Dan

  2. #2
    Guest
    Can the user select from both?
    If the user can only select from one then you could check to see if the ListView(x).SelectedItem (I think this is the property) is nothing.

    J.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Yes, the user can select from both.. So how would I determine which array the user selected from?

    Thanks,

    Dan

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Normally you would generate your message from the Click or some other event of the ListView and use the Index property where you have (0). In your case you could create a form-level variable and set it equal to the Index in the Click event. Then use that vraiable to tell which one was clicked when you press the command button.

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