| | |
Uploading picture (browse for picture)
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2007
Posts: 252
Reputation:
Solved Threads: 27
If you are using VS you can drag an OpenFileDialog, 3 buttons, textbox and a picturebox to your form.
With your first button (Browse). In this buttons click event add
Go back to your form and double click the OpenFileDialog. Add this code
go to your second button (Upload) click event and add
Finally in the third button (Remove). Open the click event for this button and add.
this should take care of browsing, displaying path, uploading and removing the image from your form.
With your first button (Browse). In this buttons click event add
vb.net Syntax (Toggle Plain Text)
OpenFileDialog.Title = "Get Image" OpenFileDialog.ShowDialog()
vb.net Syntax (Toggle Plain Text)
textbox.text = OpenFileDialog.FileName
go to your second button (Upload) click event and add
vb.net Syntax (Toggle Plain Text)
if (textbox.text.Trim() <> "") Then PictureBox.Image = Image.FromFile(textbox.text)
Finally in the third button (Remove). Open the click event for this button and add.
vb.net Syntax (Toggle Plain Text)
Picturebox.image = Nothing
this should take care of browsing, displaying path, uploading and removing the image from your form.
Last edited by ProfessorPC; Jan 8th, 2008 at 10:23 am.
add/drag opendialog control in your form , one label (for path view), one picture box (for image view) and one button (for browse image).
in your button browse add this code :
you can change the filter index to set image extension at first open. in this code filter index = 4 will set to jpeg, so when first open just jpeg image will shown. change filter index as u need.
Ok. all for the best
in your button browse add this code :
VB.NET Syntax (Toggle Plain Text)
With OpenFileDialog1 '.InitialDirectory = "C:\" .Filter = "All Files|*.*|Bitmaps|*.bmp|GIFs|*.gif|JPEGs|*.jpg" .FilterIndex = 4 End With If OpenFileDialog1.ShowDialog() = DialogResult.OK Then PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName) PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage PictureBox1.BorderStyle = BorderStyle.Fixed3D lblFilePath.Text = OpenFileDialog1.FileName() End If
Ok. all for the best
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
![]() |
Similar Threads
- Can Any one Modify (MS Access and FileMaker Pro)
- Uploading Avatar question. (Community Introductions)
Other Threads in the VB.NET Forum
- Previous Thread: Generate code Program Help
- Next Thread: Toolbar Button in Novel Groupwise mail client[Urgent]
Views: 8484 | Replies: 11
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net 2008 access add advanced application array assignment basic beginner box browser button buttons center class click client code combo convert cpu cuesent data database datagrid datagridview datetimepicker design designer dissertation dissertations editvb.net employees excel exists forms function html images isnumericfuntioncall lib listview map mobile module msaccess mssqlbackend mysql net number open page pan pdf picturebox picturebox2 port print printing printpreview problem record refresh regex reuse richtextbox right-to-left save search serial settings socket sorting sqldatbase sqlserver storedprocedure structures studio temp textbox timer txttoxmlconverter usercontol vb vb.net vb2008 vba vbnet vista visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winsock wpf wrapingcode xml






