Results 1 to 4 of 4

Thread: List Box Help

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Location
    Watertown,CT
    Posts
    8

    Lightbulb

    Ummmm......I NEED HELP.
    How do i make it so that when you select a certain item that a picture shows up in a box on the same window or text shows up.



    Ex.. You click on a selection and in the image/lable window in the corner of the screen a picture/text shows up.
    I NEED HELP!!!!!

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696

    Smile

    Hi ~@lienKiller~

    If I understand you correctly, fill the list box with the following code

    mylistbox.ListItems.Add YourKey, strDescription

    where YourKey is what you want to identitfy each record by.

    Then use the onclick event to do the following

    Code:
    strKey = mylistboz.SelectedItem.Key
    
    Select Case strKey
    Case "1"
     label1.caption = "Is"
    Case "2"
     label1.caption = "This"
    Case "3"
     label1.caption = "What"
    Case "4"
      label1.caption = "You"
    Case "5"
      label1.caption = "Want"
    End Select
    You can make the key anything you like and in the case statement you can adapt it to incorperate pictures for a picture box.

    Hope this Helps

    Ian



    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    'you need to add an Image control called image1
    'and a listbox called List1
    'change the C:\pictures\tyler1.jpg to reflect
    'your pictures and path


    Private Sub Form_Load()
    List1.AddItem "Tyler 1"
    List1.AddItem "Tyler2"
    End Sub

    Private Sub List1_Click()

    strLoadMe = List1.ListIndex + 1

    Select Case strLoadMe
    Case "1"
    Set Image1.Picture = LoadPicture("C:\pictures\tyler1.jpg")

    Case "2"
    Set Image1.Picture = LoadPicture("C:\pictures\tyler2.jpg")

    End Select

    End Sub

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Location
    Watertown,CT
    Posts
    8

    Talking Hmmmm......

    THANX that helped out alot(well the last 1 did the first 1 was a little confusing and it kept saying there was an error but thanx anyway.....
    I NEED HELP!!!!!

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