Is this a Windows Forms DataGrid? If so, you can set the column width
to zero to hide a column provided you have a non-Nothing tablestyle.
Here is some code snippets.
'.... make sure your DataGrid is using a tablestyle
dataGrid1.DataSource = _dataSet.Tables("customers")
Dim dgts As New DataGridTableStyle()
dgts.MappingName = "customers"
dataGrid1.TableStyles.Add(dgts)
'......
'method to set a column with by colnumber
Public Sub SetColWidth(tableStyle As DataGridTableStyle, colNum As
Integer, width As Integer)
Try
tableStyle.GridColumnStyles(colNum).Width = width
tableStyle.DataGrid.Refresh()
Catch 'empty catch .. do nothing
End Try
End Sub 'SetColWidth
'....
' here is how you might call this method
Private Sub button1_Click(sender As Object, e As System.EventArgs)
Dim tableStyle As DataGridTableStyle =
dataGrid1.TableStyles("customers")
SetColWidth(tableStyle, 1, 0) 'set width to zero
End Sub 'button1_Click
===============
Clay Burch
Syncfusion, Inc.
Wayne Pedersen - 12 Apr 2007 14:38 GMT
In the designer (or via code) you can toggle the columns Visible
property off.
HTH,
Wayne P.
> Is this a Windows Forms DataGrid? If so, you can set the column width
> to zero to hide a column provided you have a non-Nothing tablestyle.
[quoted text clipped - 30 lines]
> Clay Burch
> Syncfusion, Inc.
Localbar - 13 Apr 2007 04:59 GMT
Thanks
I try it also ok..
> In the designer (or via code) you can toggle the columns Visible
> property off.
[quoted text clipped - 37 lines]
> > Clay Burch
> > Syncfusion, Inc.
Localbar - 13 Apr 2007 04:59 GMT
now is ok...
Thanks Clay
> Is this a Windows Forms DataGrid? If so, you can set the column width
> to zero to hide a column provided you have a non-Nothing tablestyle.
[quoted text clipped - 30 lines]
> Clay Burch
> Syncfusion, Inc.