How can i upload image, like uploading of BackGroundImage?
Printable View
How can i upload image, like uploading of BackGroundImage?
You mean uploading something to a webserver or ???
Upload Image from a file to picturebox... just like when I'm set a backGroundImage, i want to do it on a button...
Ok, then it really wouldnt be called uploading but rather just setting an image to a picturebox.
:)Code:Private Sub btnBrowsePic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowsePic.Click
With Me.dlgOpenFile
.Filter = "Image files only (.gif, .jpg, bmp)|*.gif; *.jpg; *.bmp"
.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)
If .ShowDialog = DialogResult.OK Then
Dim Image1 As Image
Image1 = New Bitmap(.FileName())
Me.PictureBox1.Image = Image1
End If
End With
End Sub
Thansk men...
Can you explain to me why there is |*.gif; *.jpg; *.bmp" even though i already declared a .gif, .jpg, bmp.......
The bit on the left of the vertical bar is what gets displayed to the user while the bit on the right is the actual filter used by the dialogue. You often do but you don't have to include the filter in what gets displayed to the user.
The filters always come in pairs like that. If you want a choice of two filters you would have four sections separated by vertical bars. The first and third would what got displayed to the user while the second and fourth would be the actual filters.
Try setting this as the filetr for a dialogue:and then try this:Code:Image Files|*.gif; *.jpg; *.png; *.bmp|All Files|*.*
Notice that the functionality of the dialogue doesn't change. Only what the user sees changes, because you've added the extra bit to the string displayed to the user.Code:Image Files (*.gif, *.jpg, *.png, *.bmp)|*.gif; *.jpg; *.png; *.bmp|All Files|*.*
I see, Got it!... thanks