Picture Box  
Author Message
gniwnav13





PostPosted: Wed Mar 14 10:11:07 CDT 2007 Top

Visual Basic >> Picture Box

I am new VB 6 learner. I have two picture: picture1 & picture2. two command
button: command button1 & button2. When form load, picture1 is load in
picture box1 and when command button1 is click picture2 is load in picture
box1. if user click command button2 computer beep.Pls help new learner.

Visual Studio231  
 
 
Dave





PostPosted: Wed Mar 14 10:11:07 CDT 2007 Top

Visual Basic >> Picture Box

>I am new VB 6 learner. I have two picture: picture1 & picture2. two command
> button: command button1 & button2. When form load, picture1 is load in
> picture box1 and when command button1 is click picture2 is load in
> picture
> box1. if user click command button2 computer beep.Pls help new learner.

OK, so what have you done so far, what specific aspect(s) do you need help
with?
If you want someone to write the whole thing for you, forget it, you need to
work out as much as you can then come back here with any problems you've
encountered.
To get you started, have a look at the help for the LoadPicture function and
the Beep statement.

Best Regards
Dave O.


 
 
zonga777





PostPosted: Wed Mar 14 17:24:05 CDT 2007 Top

Visual Basic >> Picture Box I forgot to includ my code:

Private Sub Form_Load()
Picture1.Picture = LoadPicture("C:\image\PG1.bmp")
End Sub

Private Sub Command1_Click()
If Picture1.Picture = ("C:\image\PG1.bmp") Then
Picture1.Picture = LoadPicture("C:\image\PG2.bmp")
Else
Beep
End If

End Sub
I am getting eror msg: Type mismatch. help





> >I am new VB 6 learner. I have two picture: picture1 & picture2. two command
> > button: command button1 & button2. When form load, picture1 is load in
> > picture box1 and when command button1 is click picture2 is load in
> > picture
> > box1. if user click command button2 computer beep.Pls help new learner.
>
> OK, so what have you done so far, what specific aspect(s) do you need help
> with?
> If you want someone to write the whole thing for you, forget it, you need to
> work out as much as you can then come back here with any problems you've
> encountered.
> To get you started, have a look at the help for the LoadPicture function and
> the Beep statement.
>
> Best Regards
> Dave O.
>
>
>
 
 
Mike





PostPosted: Wed Mar 14 17:40:17 CDT 2007 Top

Visual Basic >> Picture Box


>I forgot to includ my code:
> Private Sub Form_Load()
> Picture1.Picture = LoadPicture("C:\image\PG1.bmp")
> End Sub
> Private Sub Command1_Click()
> If Picture1.Picture = ("C:\image\PG1.bmp") Then
> Picture1.Picture = LoadPicture("C:\image\PG2.bmp")
> Else
> Beep
> End If
> End Sub
> I am getting eror msg: Type mismatch. help

I'm not really sure what you are trying to do ther, nor why you are trying
to do it, but the Picture property of a PictureBox is an object, not a file
name. There are probablt lots of very good ways of doing wehat you require
(if only I knew what it was you were trying to do!) but in the meantime you
could make the above code work by setting a variable (perhaps the Tag
proprty of the PicBox) to the file name and then testing that. For example,
something like the following (beware "air code"):

Private Sub Form_Load()
Picture1.Picture = LoadPicture("C:\image\PG1.bmp")
Picture1.Tag = "C:\image\PG1.bmp"
End Sub

Private Sub Command1_Click()
If Picture1.Tag = "C:\image\PG1.bmp" Then
Picture1.Picture = LoadPicture("C:\image\PG2.bmp")
Picture1.Tag = "C:\image\PG2.bmp"
Else
Beep
End If
End Sub

Mike


 
 
zonga777





PostPosted: Thu Mar 15 13:46:17 CDT 2007 Top

Visual Basic >> Picture Box I tried your advice and it works. Thanks.





>
> >I forgot to includ my code:
> > Private Sub Form_Load()
> > Picture1.Picture = LoadPicture("C:\image\PG1.bmp")
> > End Sub
> > Private Sub Command1_Click()
> > If Picture1.Picture = ("C:\image\PG1.bmp") Then
> > Picture1.Picture = LoadPicture("C:\image\PG2.bmp")
> > Else
> > Beep
> > End If
> > End Sub
> > I am getting eror msg: Type mismatch. help
>
> I'm not really sure what you are trying to do ther, nor why you are trying
> to do it, but the Picture property of a PictureBox is an object, not a file
> name. There are probablt lots of very good ways of doing wehat you require
> (if only I knew what it was you were trying to do!) but in the meantime you
> could make the above code work by setting a variable (perhaps the Tag
> proprty of the PicBox) to the file name and then testing that. For example,
> something like the following (beware "air code"):
>
> Private Sub Form_Load()
> Picture1.Picture = LoadPicture("C:\image\PG1.bmp")
> Picture1.Tag = "C:\image\PG1.bmp"
> End Sub
>
> Private Sub Command1_Click()
> If Picture1.Tag = "C:\image\PG1.bmp" Then
> Picture1.Picture = LoadPicture("C:\image\PG2.bmp")
> Picture1.Tag = "C:\image\PG2.bmp"
> Else
> Beep
> End If
> End Sub
>
> Mike
>
>
>