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. General Programming
  3. Visual Basic
  4. Picture box binding problem

Picture box binding problem

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasewpfwcf
6 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 2003 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

    M 1 Reply Last reply
    0
    • B Binary0110

      I'm trying to bind a picture box to my access 2003 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

      M Offline
      M Offline
      Madni Abbasi
      wrote on last edited by
      #2

      'use to save image file Dim arr() As Byte FileOpen(1,"FilePath" , OpenMode.Binary, OpenAccess.Read, OpenShare.Shared) 'Resize array so that it can accomodate the file ReDim arr(FileLen("FilePath") - 1) FileGet(1, arr) FileClose(1) 'use to read image file arr = ds.Tables("TableName").Rows(0).Item("ColumnName") 'comapny logo is the name of PictureBox control CompanyLogo.Image = CompanyLogo.Image.FromStream(New IO.MemoryStream(arr))

      A 1 Reply Last reply
      0
      • M Madni Abbasi

        'use to save image file Dim arr() As Byte FileOpen(1,"FilePath" , OpenMode.Binary, OpenAccess.Read, OpenShare.Shared) 'Resize array so that it can accomodate the file ReDim arr(FileLen("FilePath") - 1) FileGet(1, arr) FileClose(1) 'use to read image file arr = ds.Tables("TableName").Rows(0).Item("ColumnName") 'comapny logo is the name of PictureBox control CompanyLogo.Image = CompanyLogo.Image.FromStream(New IO.MemoryStream(arr))

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        I tried that and it bombed here: picCover.Image = picCover.Image.FromStream(New IO.MemoryStream(arr)) might it be a problem with access?

        M 1 Reply Last reply
        0
        • A Anonymous

          I tried that and it bombed here: picCover.Image = picCover.Image.FromStream(New IO.MemoryStream(arr)) might it be a problem with access?

          M Offline
          M Offline
          Madni Abbasi
          wrote on last edited by
          #4

          use Dataset to retrieve and save image I am using following lines .there is no error arr = ds.Tables("CompanyInfo").Rows(0).Item("CompanyLogo") CompanyLogo.Image = CompanyLogo.Image.FromStream(New IO.MemoryStream(arr)) there is also an article with demo project(using access) is available in this group. try to search with keyword "Image"

          B 1 Reply Last reply
          0
          • M Madni Abbasi

            use Dataset to retrieve and save image I am using following lines .there is no error arr = ds.Tables("CompanyInfo").Rows(0).Item("CompanyLogo") CompanyLogo.Image = CompanyLogo.Image.FromStream(New IO.MemoryStream(arr)) there is also an article with demo project(using access) is available in this group. try to search with keyword "Image"

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

            ok I'll try it thanx BINARY

            B 1 Reply Last reply
            0
            • B Binary0110

              ok I'll try it thanx BINARY

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

              nope nothing, If any one could build a sample to show me where I'm going wrong. I've heard something about header information in the field. 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