Click to See Complete Forum and Search --> : Getting Multiple Picture to load at run time
Leeper77
Jan 14th, 2000, 09:48 PM
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
X_Darknight_X
Jan 15th, 2000, 12:31 AM
In your Select Case statement, take off the quotation marks around it.
Select Case lblname
------------------
David Underwood
Teen Programmer
ICQ - 14028049 (http://www.icq.com/14028049)
E-mail - darknight23@hotmail.com
[This message has been edited by X_Darknight_X (edited 01-15-2000).]
X_Darknight_X
Jan 15th, 2000, 12:59 AM
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 (http://www.icq.com/14028049)
E-mail - darknight23@hotmail.com
[This message has been edited by X_Darknight_X (edited 01-15-2000).]
X_Darknight_X
Jan 15th, 2000, 08:50 AM
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 (http://www.icq.com/14028049)
E-mail - darknight23@hotmail.com
X_Darknight_X
Jan 15th, 2000, 09:06 AM
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 (http://www.icq.com/14028049)
E-mail - darknight23@hotmail.com
Leeper77
Jan 15th, 2000, 09:27 AM
tried the trim with no luck does the trim take out any extra spaces? Well next stage of frustration for us all :)
X_Darknight_X
Jan 15th, 2000, 09:31 AM
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 (http://www.icq.com/14028049)
E-mail - darknight23@hotmail.com
Leeper77
Jan 15th, 2000, 09:33 AM
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
X_Darknight_X
Jan 15th, 2000, 09:37 AM
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 (http://www.icq.com/14028049)
E-mail - darknight23@hotmail.com
Leeper77
Jan 15th, 2000, 09:39 AM
i take that back yes there is the first name in the database
X_Darknight_X
Jan 15th, 2000, 09:40 AM
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 (http://www.icq.com/14028049)
E-mail - darknight23@hotmail.com
X_Darknight_X
Jan 15th, 2000, 09:55 AM
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 (http://www.icq.com/14028049)
E-mail - darknight23@hotmail.com
Leeper77
Jan 15th, 2000, 09:56 AM
yes there is a data control which changes the name in lblname
Leeper77
Jan 15th, 2000, 10:00 AM
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
X_Darknight_X
Jan 15th, 2000, 10:04 AM
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 (http://www.icq.com/14028049)
E-mail - darknight23@hotmail.com
Leeper77
Jan 15th, 2000, 10:05 AM
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
X_Darknight_X
Jan 15th, 2000, 10:10 AM
Just make sure you clear the picturebox before you load other pictures into it.
------------------
David Underwood
Cannabatech Corporation
ICQ - 14028049 (http://www.icq.com/14028049)
E-mail - darknight23@hotmail.com
Leeper77
Jan 15th, 2000, 10:12 AM
do i do the loadpicture ("") after each case then or what?
X_Darknight_X
Jan 15th, 2000, 10:20 AM
Yep
------------------
David Underwood
Cannabatech Corporation
ICQ - 14028049 (http://www.icq.com/14028049)
E-mail - darknight23@hotmail.com
Leeper77
Jan 15th, 2000, 10:53 AM
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.
JorgeLedo
Jan 15th, 2000, 11:03 AM
Try refreshing the form in the end of Form_Load.
I.E.: Fomr.Refresh
------------------
Jorge Ledo
j_ledo@hotmail.com
Portugal
KENNNY
Jan 15th, 2000, 11:09 AM
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 :p
www.cintelsoftware.co.uk
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.