What is wrong about these codes
Hi, I have openfiledialog, and I use this code to open the file on pc but I get error that (formfile is not a member of system.drawing.image) below is the code.
Code:
Private Sub btnBrowse_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnBrowse.Click
With OpenFileDialog1
.InitialDirectory = "\My Document\My Pictures"
.Filter = "All Files|*.*|Bitmaps|*.bmp|GIFs|*.gif|JPEGs|*.jpg"
.FilterIndex = 2
End With
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
With Picture1
.Image = Image.Fromfile(OpenFileDialog1.FileName)
.SizeMode = PictureBoxSizeMode.CenterImage
End With
Me.txtFileName.Text = OpenFileDialog1.FileName
End If
End Sub
Also I get error message about the code below as well that (fromstream is not a member of system.drawing.image)
Code:
Private Sub btnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
Dim arrPicture() As Byte = _
CType(dsPictures.Tables(0).Rows(lstPictures.SelectedIndex)("Picture"), _
Byte())
Dim ms As New MemoryStream(arrPicture)
With Picture2
.Image = Image.fromStream(ms)
.SizeMode = PictureBoxSizeMode.StretchImage
End With
txtFileName.Text = _
dsPictures.Tables(0).Rows(lstPictures.SelectedIndex)("PictureName").ToString
ms.Close()
End Sub
Could anyone help.
Re: What is wrong about these codes
Hey,
The Framework that is used on a Windows Mobile Device does not support every method that is in the full blown Framework, so it is possible that these two methods are not there.
I have just tried to do the same thing as you, and I get the same error.
Gary
Re: What is wrong about these codes
Ya, FromFile is not supported in the CF.