Please all, I am a young female programmer who designed a form. In the form there is a field for image. How will i add a browse to it so that the person felling the form will browse to pick the picture from his system.
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
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 :
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
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.
tanx,
I realy apreciated ur concern.it has worked.
Another problem is on the deploying, if i install on another system it will not see the connection. why this i saved the database in my d: drive. pls. help.
Dim UploadFileControl As FileUpload
UploadFileControl = ImageFieldID
If UploadFileControl.HasFile Then
UpldFile.Add(UploadFileControl)
// check for extention of the file
if exist()
// save the image
hi there..im new in vb.net..actually i want to upload a pic(browse for pic) into my form...but then,i dont see any openfiledialog n picturebox in my toolbox to be dragged in..pls help me asap..tq..