Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. picture box binding problem

picture box binding problem

Scheduled Pinned Locked Moved Database
csharpdatabasewpfwcf
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Binary0110
    wrote on last edited by
    #1

    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

    D M 2 Replies Last reply
    0
    • B Binary0110

      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

      D Offline
      D Offline
      Dan_P
      wrote on last edited by
      #2

      What is the error message ?

      B 1 Reply Last reply
      0
      • D Dan_P

        What is the error message ?

        B Offline
        B Offline
        Binary0110
        wrote on last edited by
        #3

        An unhandled exception of type 'System.ArgumentException' occurred in system.drawing.dll Additional information: Invalid parameter used. BINARY

        1 Reply Last reply
        0
        • B Binary0110

          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

          M Offline
          M Offline
          Michael Potter
          wrote on last edited by
          #4

          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.

          B 1 Reply Last reply
          0
          • M Michael Potter

            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.

            B Offline
            B Offline
            Binary0110
            wrote on last edited by
            #5

            It may bomb there as well but I haven't gotten that far BINARY

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups