![]() |
| ||
| About Picture Box in Visual Box Help Please! im beginner in visual basic can anyone help me please? i have 1 command botton and 1 picturebox my command button name is Switch every time i click my command button Switch the image in the picturebox change for example i have already an image in the picturebox Sunset image if i click my command Button the image change to Winter if i click once again my command button the image should change to Sunset if i click it again the image should Winter in the picture box heres my code in form load Private Sub Form_Load() picture1.picture = LoadPicture("D:\hehe\Winter.jpg" End Sub please help me badly needed! god bless you daniweb and more power! |
| ||
| Re: About Picture Box in Visual Box Help Please! u try the code snippet: Private Sub cmdSwitch_click() if picture1.picture ="D:\hehe\Winter.jpg" then picture1.picture = LoadPicture("D:\hehe\Sunset.jpg" else picture1.picture = LoadPicture("D:\hehe\Winter.jpg" end sub this would do for switch similarly for the pictue click change in picture write the same code in the picture1_click event... this should solve ur problem |
| ||
| Re: About Picture Box in Visual Box Help Please! your code is error it say type mismatch! huhuhuhuhuhu please help me! |
| ||
| Re: About Picture Box in Visual Box Help Please! dont just copy the code,match the braces it is just a code snippet so use the correct syntax Private Sub cmdSwitch_click()also check the button name....i mean ur caption is switch ,so i assumed ur button name to be cmdSwitch.. |
| ||
| Re: About Picture Box in Visual Box Help Please! Ya , rite that is the way to do the program. the code works fine |
| ||
| Re: About Picture Box in Visual Box Help Please! the error is type mismatch that is the code i put in my command button still got error type mismatch here's my code in my command button: Private Sub Command1_Click() If Picture1.Picture = "D:\hehe\Winter.jpg" Then Picture1.Picture = LoadPicture("D:\hehe\Sunset.jpg") Else Picture1.Picture = LoadPicture("D:\hehe\Winter.jpg") End If End Sub still not work huhuhu |
| ||
| Re: About Picture Box in Visual Box Help Please! Hi, Its always Better to Keep a Static Boolean Variable in such cases... Try this : Private Sub Command1_Click() Static Variables are Variables declared within the Procedure and retain their values as long as the code is running Regards Veena |
| ||
| Re: About Picture Box in Visual Box Help Please! finally your so genious qveen72 thanks for this code its work weeeee! |
| ||
| Re: About Picture Box in Visual Box Help Please! Hi, Thnx, Mark the Thread as Solved.. Regards Veena |
| All times are GMT -4. The time now is 3:49 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC