Results 1 to 3 of 3

Thread: [RESOLVED] textbox capturing listbox text scenario

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2006
    Posts
    18

    Resolved [RESOLVED] textbox capturing listbox text scenario

    Bad title description probably...


    I have two listboxes and one text box,basically whatever item is selected in listbox1 ,the listindex of listbox2 matches the item of listbox1...

    example:
    listbox1 first item is orange,listbox2 first item is apple,so if listbox1 item is selected then apple is automatically selected on listbox2...simple enough so far,but i want the textbox to capture the text of listbox2 and store it in the textboxes text property...

    problem is the textbox only stores the second item of listbox2 and not the first item..now i realize from previous posts on this forum that the listbox starts with 0 ,and ends with -1

    but im having problems coding an IF statement on the listbox1 click event :

    Code:
    Private Sub lstfruits_Click()
    
    If lstbox1.ListIndex Then
    lstbox2.ListIndex = lstbox1.listindex
    txtstoredfruit.Text = lstbox2.Text
    End If
    End Sub
    so my question is,how would I fit the 0 and -1 into this IF statement?.




    edit*** nevermind i figured it out ..sorry
    Last edited by tinethle; Dec 21st, 2006 at 05:10 PM.

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