|
-
May 4th, 2004, 08:33 AM
#1
Thread Starter
Addicted Member
Loading Images[solved]
Is it possible to load an image (with LoadPicture()) into an variable?
I need to preload some images before i use them, and using an ImageList seems kinda komplex, so i'm wondering if you can load images into variables in runtime, or something like that.
Thanks in advance
Last edited by vigge89; May 4th, 2004 at 08:51 AM.
-
May 4th, 2004, 08:36 AM
#2
Frenzied Member
Well this seems to work:
VB Code:
Dim tmpImg As IPictureDisp
'to put a picture in a variable
Set tmpImg = LoadPicture("c:\thisimage.jpg")
..
..
..
'then - to put the picture in an Image control
Image1.Picture = tmpImg
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
May 4th, 2004, 08:36 AM
#3
Fanatic Member
you could use a resource file to store the images....there should be some examples in this forum if you do a search...if not, post back and I will provide one. cheers
"Knowledge is gained when different people look at the same information in different ways"
- Louis Pasteur
-
May 4th, 2004, 08:50 AM
#4
Thread Starter
Addicted Member
hmm, i have declared the variable in one of my forms (frmMain), as an Public variable (Public var as Type), but when i do this:
VB Code:
frmMain.img_btn_normal = LoadPicture(btn_normal)
frmMain.img_btn_down = LoadPicture(btn_down)
I get runtime error 91: "Object variable or With block variable not set"
Why doesn't it work?
-
May 4th, 2004, 08:51 AM
#5
Thread Starter
Addicted Member
Forgot the SET
Solved, thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|