Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic (http://www.programmingforums.org/forum18.html)
-   -   need picture help (http://www.programmingforums.org/showthread.php?t=9877)

RAzR Creations May 20th, 2006 3:11 PM

need picture help
 
ok say i have a picture box and want users to be able to upload there own picture into itt what do i do?

kruptof May 20th, 2006 3:26 PM

Try this:
Quote:

OpenDialog.ShowOpen
Form1.Caption = OpenDialog.FileName
Picture1.Picture = LoadPicture(OpenDialog.FileName)
you have to use the open dialog or if you want you can create your own one. then you just set the picture property(picture1.picture) to that they have selected from the open dialog and then pass that to loadpicture function, you can improve this by filter out other files such as text files and other non image files from the user in the open dialog box.

RAzR Creations May 20th, 2006 5:14 PM

i dont fully understand

kruptof May 21st, 2006 3:43 AM

Can you be more specific what don't you understand, any ways here is a little guide to help you:

okay on the menu bar goto project click it, then click the sub menu "Components", then the components dialog box would come up, now scroll down and select Microsoft Common Dialog Control x(x= what version number you are using) check the check box next to its name and then click apply.Click Close to get back to form. Now you should see a new control on the ToolBox called "CommonDialog", put it onto the form, using the properties window change its name to "OpenDialog", now put the picture box onto the form, and also put a command button onto the form. Double click the command button(to get to its command_click event), and put this code into the Command_Click Event:

Quote:

OpenDialog.Filter = "Bitmaps (.bmp)|*.bmp"
OpenDialog.ShowOpen
Form1.Caption = OpenDialog.FileName
Picture1.Picture = LoadPicture(OpenDialog.FileName)


All times are GMT -5. The time now is 4:32 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC