Results 1 to 22 of 22

Thread: Getting Multiple Picture to load at run time

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Post

    I am having a problem. I am trying to make a program with 200 plus pictures and a database. I have successfully been able to get the pictures related to the data to load in a click event but i cannot in the form load page here is an example. When the database loads the name in the lable then the picture is supposed to load.

    Private Sub Form_Load()
    Select Case "lblname"
    Case "1997 Holiday Teddy"
    '1997 Holiday Teddy Picture
    If lblname = "1997 Holiday Teddy" Then
    Picture1.Picture = LoadPicture("C:\My Documents\Project\Babies\97teddy3_small.jpg")
    End If
    End Select
    End Sub

    I have checked the path just to make sure i mispelled or misdirected the path but i havent do any of you have any ideas? thanks

  2. #2
    Member
    Join Date
    Jul 1999
    Location
    J-ville, NC
    Posts
    54

    Post

    In your Select Case statement, take off the quotation marks around it.

    Select Case lblname

    ------------------
    David Underwood
    Teen Programmer

    ICQ - 14028049
    E-mail - [email protected]




    [This message has been edited by X_Darknight_X (edited 01-15-2000).]

  3. #3
    Member
    Join Date
    Jul 1999
    Location
    J-ville, NC
    Posts
    54

    Post

    So your code looks like this right?

    Private Sub Form_Load()
    Select Case lblname.Caption
    Case Is = "1997 Holiday Teddy"
    '1997 Holiday Teddy Picture
    Picture1.Picture = LoadPicture("C:\My Documents\Project\Babies\97teddy3_small.jpg")
    End Select
    End Sub

    If that still doesn't work then the caption <> "1997 Holiday Teddy" or you're referred to the wrong label.

    Private Sub Form_Load()
    Select Case lblname.Caption
    Case Is <> "1997 Holiday Teddy"
    '1997 Holiday Teddy Picture
    Picture1.Picture = LoadPicture("C:\My Documents\Project\Babies\97teddy3_small.jpg")
    End Select
    End Sub

    ------------------
    David Underwood
    Teen Programmer

    ICQ - 14028049
    E-mail - [email protected]




    [This message has been edited by X_Darknight_X (edited 01-15-2000).]

  4. #4
    Member
    Join Date
    Jul 1999
    Location
    J-ville, NC
    Posts
    54

    Post

    Do you have any text in the label's caption property? I mean, when you press play, is there any preentered text already in the label's caption property? Also, only 1 picture should display because you're only checking the status of lblnames.Caption.
    Where is the "1997 Holiday Teddy" and "1998 Holiday Teddy" text coming from? I know it's in the label but how is the text getting there? Whatever happening, when the form_load event is triggered, the caption is not equaling "1997 Holiday Teddy".

    ------------------
    David Underwood
    Teen Programmer

    ICQ - 14028049
    E-mail - [email protected]



  5. #5
    Member
    Join Date
    Jul 1999
    Location
    J-ville, NC
    Posts
    54

    Post

    Whew....hmmmmm, well then try this:

    Private Sub Form_Load()
    Select Case Trim(lblname.Caption)
    Case Is = "1997 Holiday Teddy"
    '1997 Holiday Teddy Picture
    Picture1.Picture = LoadPicture("C:\My Documents\Project\Babies\97teddy3_small.jpg")
    Case Is = "1998 Holiday Teddy"
    '1998 Holiday Teddy Picture
    Picture1.Picture = LoadPicture("C:\My Documents\Project\Babies\98teddy_small.jpg")
    End Select

    Maybe there's some extra spaces being added at the end or at the beginning of the text.
    We're going to figure this out!!!

    ------------------
    David Underwood
    Cannabatech Corporation

    ICQ - 14028049
    E-mail - [email protected]




  6. #6

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Post

    tried the trim with no luck does the trim take out any extra spaces? Well next stage of frustration for us all


  7. #7
    Member
    Join Date
    Jul 1999
    Location
    J-ville, NC
    Posts
    54

    Post

    Ok where are you assigning the name of the teddy bear, in the database, to the label? And what's the code you're using?

    ------------------
    David Underwood
    Cannabatech Corporation

    ICQ - 14028049
    E-mail - [email protected]




  8. #8

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Post

    im using the data field in the properties of the label is that how i should do i or is it easier doing it the manual way

  9. #9
    Member
    Join Date
    Jul 1999
    Location
    J-ville, NC
    Posts
    54

    Post

    I'm not really familiar with databases....
    When the form loads up, is there anything written in the label?

    ------------------
    David Underwood
    Cannabatech Corporation

    ICQ - 14028049
    E-mail - [email protected]




  10. #10

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Post

    i take that back yes there is the first name in the database

  11. #11
    Member
    Join Date
    Jul 1999
    Location
    J-ville, NC
    Posts
    54

    Post

    Then how can you check in the form_load if the label = "1997 Holiday Teddy" when there's nothing in the label?

    ------------------
    David Underwood
    Cannabatech Corporation

    ICQ - 14028049
    E-mail - [email protected]




  12. #12
    Member
    Join Date
    Jul 1999
    Location
    J-ville, NC
    Posts
    54

    Post

    I assume somehow the text in the labels caption changes because you have multiple cases equaling different things. Like

    Case Is = "1997 Holiday Bear"
    Case Is = "1998 Holiday Bear"

    When is the text supposed to change? Does the user do it somewhere in the program?

    ------------------
    David Underwood
    Cannabatech Corporation

    ICQ - 14028049
    E-mail - [email protected]




  13. #13

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Post

    yes there is a data control which changes the name in lblname

  14. #14

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Post

    Dark Knight I GOT IT!!!!! I switched all the code to the data control and it works
    thank you so very much you dont know how much you have helped me
    hey i have you on icq im computercowboy when you ever get on icq next

  15. #15
    Member
    Join Date
    Jul 1999
    Location
    J-ville, NC
    Posts
    54

    Post

    I was wondering why you were putting it in the form load......I'm glad I could be help, even though it took us a while to figure it out.

    ------------------
    David Underwood
    Cannabatech Corporation

    ICQ - 14028049
    E-mail - [email protected]




  16. #16

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Post

    just have to do a little tweaking
    it loads the picture like one late and doesnt go back very easy but im sure ill figure it out

  17. #17
    Member
    Join Date
    Jul 1999
    Location
    J-ville, NC
    Posts
    54

    Post

    Just make sure you clear the picturebox before you load other pictures into it.



    ------------------
    David Underwood
    Cannabatech Corporation

    ICQ - 14028049
    E-mail - [email protected]




  18. #18

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Post

    do i do the loadpicture ("") after each case then or what?

  19. #19
    Member
    Join Date
    Jul 1999
    Location
    J-ville, NC
    Posts
    54

    Post

    Yep

    ------------------
    David Underwood
    Cannabatech Corporation

    ICQ - 14028049
    E-mail - [email protected]




  20. #20

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Post

    can i ask one last question. My pictures are loading fine, except for one thing they are loading one late like back in the code the #1 bear picture would load in the 1997 Employee bear picture and so on any questions. It also has trouble going backwards as well.

  21. #21
    Addicted Member
    Join Date
    Oct 1999
    Location
    Oporto, Portugal
    Posts
    134

    Post

    Try refreshing the form in the end of Form_Load.


    I.E.: Fomr.Refresh

    ------------------
    Jorge Ledo
    [email protected]
    Portugal

  22. #22
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355

    Post

    also, in your code, you've done
    select case "lblname"..
    then..
    if lblname = "1997 Holiday Teddy"

    you dont need the if ; youve checked it already through select case



    ------------------
    cintel rules
    www.cintelsoftware.co.uk

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