OMG so simple yet so hard picturebox help
Posted: Sat Aug 11, 2012 5:14 pm
Okay I want to save an image from a webpage in a way like IE or chrome ect I have tried this code yet it does not work and I have no IDEA why
Code: Select all
Any help would be most aprechated Try
Dim pbx As New PictureBox
pbx.ImageLocation = ToolStrip1.Text
Dim sfd As New SaveFileDialog
sfd.Title = "Save your Image as...."
sfd.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyPictures
sfd.Filter = "Jpeg files (*.jpg)|*.jpg|Bitmap files (*.bmp)|*.bmp"
Dim result As DialogResult = sfd.ShowDialog
If result = Windows.Forms.DialogResult.OK Then
If sfd.FileName <> String.Empty Then
Dim MyImageFormat As System.Drawing.Imaging.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg
If sfd.FileName.ToString.ToUpper.EndsWith("JPG") Then
MyImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg
ElseIf sfd.FileName.ToString.ToUpper.EndsWith("BMP") Then
MyImageFormat = System.Drawing.Imaging.ImageFormat.Bmp
End If
pbx.Image.Save(sfd.FileName, MyImageFormat)
End If
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try