Ver Mensaje Individual
  #3 (permalink)  
Antiguo 22/04/2004, 10:09
Artur
 
Fecha de Ingreso: noviembre-2003
Mensajes: 79
Antigüedad: 21 años, 4 meses
Puntos: 0
Lo que quiero hacer es un binding de un picturebox. He buscado por muchos sitios y no lo que encuentro no funciona.

El código que utilizo es este:

Dim bphoto As Binding = New Binding("Image", m_Dicc.DS, m_Dicc.Tabla.TableName & "." & Controls(i).Tag)
AddHandler bphoto.Format, AddressOf BindImage
Controls(i).DataBindings.Add(bphoto)

Private Sub BindImage(ByVal sender As Object, ByVal e As ConvertEventArgs)
e.Value = New Bitmap(New MemoryStream(CByte(e.Value)))
End Sub

también lo he probado con este otro código pero nada, el mismo error:

Dim bphoto As Binding = New Binding("Image", m_Dicc.DS, m_Dicc.Tabla.TableName & "." & Controls(i).Tag)
AddHandler bphoto.Format, AddressOf PictureFormat
Controls(i).DataBindings.Add(bphoto)

Private Sub PictureFormat(ByVal sender As Object, ByVal e As ConvertEventArgs)
Dim b() As Byte = New Byte(e.Value) {}
Dim ms As MemoryStream = New MemoryStream
Dim offset As Integer = 78
ms.Write(b, offset, b.Length - offset)
Dim bmp As Bitmap = New Bitmap(ms)
ms.Close()
'Writes the new value back
e.Value = bmp
End Sub

Ya no se que hacer. Ayer me intentaste ayudar y te lo agradezco mucho. Se te ocurre algo?