[RESOLVED] Need help with Openning JPG
I have on "open" dialog like this:
VB Code:
On Error GoTo ErrHandler
CommonDialog1.Filter = "JPG (*.jpg)|*.jpg"
CommonDialog1.FilterIndex = 2
CommonDialog1.ShowOpen
Exit Sub
ErrHandler:
Exit Sub
I am trying to have the the file selected show up in Image1.... Please help. Thanks in advance
Re: Need help with Openning JPG
to load it in the picturebox you need to use the LoadPicture function, like
Picture1.Picture = LoadPicture("C:\somefile.jpg")
Re: Need help with Openning JPG
The commondialog only gets the filename for you, to do anything with the file you need to add extra code.
Luckily there is a simple piece of code to load a picture (called LoadPicture), which can be used like this:
VB Code:
Set Image1.Picture = LoadPicture(CommonDialog1.FileName)
This line of code should be placed just after your ".ShowOpen" line.
Re: Need help with Openning JPG