• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

VB Image Question

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

Kasm

Member
Joined
Jan 22, 2005
I am making a program that I need a picture on a form to change depending on the users input. Is it possible to change an image after the program is running? I would just use multiple images and play with the visible property but there are too many pictures.

This is a simple example of what i am trying to do:

Private Sub Go1_Click()
Image1.Picture = "C:\Documents and Settings\User\Desktop\Test\Go1.jgp"
End Sub

Private Sub Go2_Click()
Image1.Picture = "C:\Documents and Settings\User\Desktop\Test\Go2.jgp"
End Sub

Private Sub Go3_Click()
Image1.Picture = "C:\Documents and Settings\User\Desktop\Test\Go3.jgp"
End Sub

Those command go to three buttons that I was trying to get an image so change. However when I run the program and press the button I get a "type mismatch" error.

Anyone know how I can whoop this problem?
 
I am making a program that I need a picture on a form to change depending on the users input. Is it possible to change an image after the program is running? I would just use multiple images and play with the visible property but there are too many pictures.

This is a simple example of what i am trying to do:

Private Sub Go1_Click()
Image1.Picture = "C:\Documents and Settings\User\Desktop\Test\Go1.jgp"
End Sub

Private Sub Go2_Click()
Image1.Picture = "C:\Documents and Settings\User\Desktop\Test\Go2.jgp"
End Sub

Private Sub Go3_Click()
Image1.Picture = "C:\Documents and Settings\User\Desktop\Test\Go3.jgp"
End Sub

Those command go to three buttons that I was trying to get an image so change. However when I run the program and press the button I get a "type mismatch" error.

Anyone know how I can whoop this problem?

Try

Image1.Picture = LoadPicture("C:\Documents and Settings\User\Desktop\Test\Go1.jgp")
 
Thank you for your response. I tried it and it still didn't work. Any other ideas?
 
Back