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. Help controlling columns in datagrid

Help controlling columns in datagrid

Scheduled Pinned Locked Moved Visual Basic
helpdata-structuresquestion
3 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.
  • G Offline
    G Offline
    Gaz UK
    wrote on last edited by
    #1

    Hi, I'm trying to do something very simple, however I seem to going rouund in circles! 1. I have an Array which is loaded from a file, I then load it into a DataTable, at the same time adding Column names. 2. I create a DataView from the Datatable. 3. I asign the DataView to a Datagrid using Datagrid.DataSource = DataView 4. Run, everything works fine. The issue... I want to change the size of the columns and hide some occasionally. I tried using DatagridTableStyles are per several submissions on the web, but it won't work. Any ideas? Is there a simple way of doing this?

    D 1 Reply Last reply
    0
    • G Gaz UK

      Hi, I'm trying to do something very simple, however I seem to going rouund in circles! 1. I have an Array which is loaded from a file, I then load it into a DataTable, at the same time adding Column names. 2. I create a DataView from the Datatable. 3. I asign the DataView to a Datagrid using Datagrid.DataSource = DataView 4. Run, everything works fine. The issue... I want to change the size of the columns and hide some occasionally. I tried using DatagridTableStyles are per several submissions on the web, but it won't work. Any ideas? Is there a simple way of doing this?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Using DataGridTableStyles IS the simple way of doing it, and as it happens, the only way. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      G 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Using DataGridTableStyles IS the simple way of doing it, and as it happens, the only way. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        G Offline
        G Offline
        Gaz UK
        wrote on last edited by
        #3

        Ok, thanks for that at least I'm in the right place. In that case then please can you help me to understand when the following code doesn't work, it's probably something simple... I'd really appreciate some assistance...thanks What Happens > All the data loads fine, the Datagrid1 formating works ok, but the columns are not adopting the table styles I created! coding... -->Step 1 load up 'Product' Array with Data -->Step 2 load up Column collection... Private Sub LoadColumnCollection() productColumnCollection.Add("Level3") productColumnCollection.Add("Level4") productColumnCollection.Add("Rep_ITEM") productColumnCollection.Add("Description") productColumnCollection.Add("Ext_Description") productColumnCollection.Add("End_Date") productColumnCollection.Add("Price_From") productColumnCollection.Add("Price_To") productColumnCollection.Add("Price_Comments") productColumnCollection.Add("RRP") productColumnCollection.Add("Min_ISP") productColumnCollection.Add("Max_ISP") productColumnCollection.Add("ISP%SIP") productColumnCollection.Add("%Margin") productColumnCollection.Add("Units") productColumnCollection.Add("SIP") productColumnCollection.Add("Pack_Priority") productColumnCollection.Add("Exculsive") productColumnCollection.Add("Despatch_Date") productColumnCollection.Add("ITEM_Code") productColumnCollection.Add("Lenght_Av.") productColumnCollection.Add("Unit_EAN") productColumnCollection.Add("Case_EAN") productColumnCollection.Add("Outer_EAN") productColumnCollection.Add("Length") productColumnCollection.Add("Width") productColumnCollection.Add("Height") productColumnCollection.Add("Case_Length") productColumnCollection.Add("Case_Width") productColumnCollection.Add("Case_Height") productColumnCollection.Add("Gross_Weight") productColumnCollection.Add("H") productColumnCollection.Add("Pallet_Weight") productColumnCollection.Add("Cases_Per_Layer") productColumnCollection.Add("Layers_Per_Pallet") productColumnCollection.Add("Reason_For_Change") End Sub Private Sub LoadColumnNames() Dim row As Integer Dim dC As DataColumn ' set product table up... productTable = New DataTable("Product Table") ' construct table column

        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