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