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.

Please ATTEND URGENTLY TO IT.
TANX.

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

OpenFileDialog.Title = "Get Image"
OpenFileDialog.ShowDialog()

Go back to your form and double click the OpenFileDialog. Add this code

textbox.text = OpenFileDialog.FileName

go to your second button (Upload) click event and add

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.

Picturebox.image = Nothing

this should take care of browsing, displaying path, uploading and removing the image from your form.

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.

Ok. all for the best

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.

must love Google translations... maybe posting in the native language would make it easier to understand. (ok, that was a little mean.)

Dim UploadFileControl As FileUpload
UploadFileControl = ImageFieldID
If UploadFileControl.HasFile Then
UpldFile.Add(UploadFileControl)
// check for extention of the file
if exist()
// save the image

End If

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..

thx for your reply..i do know its quite strange but then i still dont see it even the "choose item" i tick all the opendialogfile n picture box...tq

This article has been dead for over six months. Start a new discussion instead.