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. C#
  4. Binary Data in Data Grid :: C#

Binary Data in Data Grid :: C#

Scheduled Pinned Locked Moved C#
csharpcssdockerdata-structurestutorial
4 Posts 2 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.
  • V Offline
    V Offline
    valikac
    wrote on last edited by
    #1

    Hello. Given an array of binary data stored in an ArrayList container, do you associate the container as a datasource in a Data Grid control? private ArrayList xList = new ArrayList(); // Arbitrarily add 64 integers into container for (int i = 0; i < 64; ++i) this.xList.Add(i); // Assuming Data Grid was created via wizard thisTheDataGrid.DataSource = this.xList; thisTheDataGrid.Refresh(); The example above compiles okay. However, nothing shows up in the data grid. All you would see is 64 empty rows and no columns. Do you need to set a specific property to show arbitrary data in the grid? Thanks, Kuphryn

    H 1 Reply Last reply
    0
    • V valikac

      Hello. Given an array of binary data stored in an ArrayList container, do you associate the container as a datasource in a Data Grid control? private ArrayList xList = new ArrayList(); // Arbitrarily add 64 integers into container for (int i = 0; i < 64; ++i) this.xList.Add(i); // Assuming Data Grid was created via wizard thisTheDataGrid.DataSource = this.xList; thisTheDataGrid.Refresh(); The example above compiles okay. However, nothing shows up in the data grid. All you would see is 64 empty rows and no columns. Do you need to set a specific property to show arbitrary data in the grid? Thanks, Kuphryn

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      You can use any IList or IListSource implementation (ArrayList implements IList). If you have any DataGridTableStyles configured in the DataGrid.TableStyles property, you must set the DataGridTableStyle.MappingName to the type, i.e. "ArrayList", so that it is mapped correctly.

      Microsoft MVP, Visual C# My Articles

      V 1 Reply Last reply
      0
      • H Heath Stewart

        You can use any IList or IListSource implementation (ArrayList implements IList). If you have any DataGridTableStyles configured in the DataGrid.TableStyles property, you must set the DataGridTableStyle.MappingName to the type, i.e. "ArrayList", so that it is mapped correctly.

        Microsoft MVP, Visual C# My Articles

        V Offline
        V Offline
        valikac
        wrote on last edited by
        #3

        Okay. Thanks. I tried inserting "ArrayList" as the mapping name for the tablestyle. That did not make a difference. The problem is still that nothing shows up in the Data Grid. In fact, there are no grid line. All I see are row borders. Kuphryn

        H 1 Reply Last reply
        0
        • V valikac

          Okay. Thanks. I tried inserting "ArrayList" as the mapping name for the tablestyle. That did not make a difference. The problem is still that nothing shows up in the Data Grid. In fact, there are no grid line. All I see are row borders. Kuphryn

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          If you are using table styles and they don't apply to the current data binding, that what you should expect to see. Instead of an ArrayList, use an int[] array and use "int[]" as the DataGridTableStyle.MappingName. See the documentation for DataGridTableStyle.MappingName in the .NET Framework SDK for more information. Are you even using table styles? If so, maybe try not adding them and you should see something. Again, a data source can be anything that implements IList or IListSource. Some controls' DataSource properties will even except IEnumerable implementations as a last resort.

          Microsoft MVP, Visual C# My Articles

          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