picture box binding problem
-
I'm trying to bind a picture box to my access 2002 Db in vb.net Here is my code
Dim b As Binding = New Binding("Image", dsComics, "comiclist.ComicCover") AddHandler b.Format, AddressOf ConvertPicture Me.picCover.DataBindings.Add(b) Public Sub ConvertPicture(ByVal Sender As Object, ByVal e As ConvertEventArgs) Dim b() As Byte = e.Value Dim ms As MemoryStream = New MemoryStream ms.Write(b, 0, b.Length) **Dim bmp As Bitmap = New Bitmap(ms)** ms.Close() e.Value = bmp End Sub
The line in bold is where it bombs, any ideas BINARY BINARY -
I'm trying to bind a picture box to my access 2002 Db in vb.net Here is my code
Dim b As Binding = New Binding("Image", dsComics, "comiclist.ComicCover") AddHandler b.Format, AddressOf ConvertPicture Me.picCover.DataBindings.Add(b) Public Sub ConvertPicture(ByVal Sender As Object, ByVal e As ConvertEventArgs) Dim b() As Byte = e.Value Dim ms As MemoryStream = New MemoryStream ms.Write(b, 0, b.Length) **Dim bmp As Bitmap = New Bitmap(ms)** ms.Close() e.Value = bmp End Sub
The line in bold is where it bombs, any ideas BINARY BINARY -
An unhandled exception of type 'System.ArgumentException' occurred in system.drawing.dll Additional information: Invalid parameter used. BINARY
-
I'm trying to bind a picture box to my access 2002 Db in vb.net Here is my code
Dim b As Binding = New Binding("Image", dsComics, "comiclist.ComicCover") AddHandler b.Format, AddressOf ConvertPicture Me.picCover.DataBindings.Add(b) Public Sub ConvertPicture(ByVal Sender As Object, ByVal e As ConvertEventArgs) Dim b() As Byte = e.Value Dim ms As MemoryStream = New MemoryStream ms.Write(b, 0, b.Length) **Dim bmp As Bitmap = New Bitmap(ms)** ms.Close() e.Value = bmp End Sub
The line in bold is where it bombs, any ideas BINARY BINARYAre you sure it doesn't bomb on ms.Close(). The docs for the Bitmap(Stream stream) constructor say:
You must keep the stream open for the lifetime of the Bitmap object.
-
Are you sure it doesn't bomb on ms.Close(). The docs for the Bitmap(Stream stream) constructor say:
You must keep the stream open for the lifetime of the Bitmap object.
It may bomb there as well but I haven't gotten that far BINARY