隐藏在现有 Windows 窗体 DataGrid 控件中显示的 DataTable 对象的“X”列。
示例
Sub HideColumnOfDataSet()
Dim points As New System.Data.DataTable("Points")
points.Columns.Add(New DataColumn("X", GetType(Integer)))
points.Columns.Add(New DataColumn("Y", GetType(Integer)))
points.Rows.Add(New Object() {1, 2})
points.Rows.Add(New Object() {3, 5})
DataGrid1.DataSource = points
Dim tableStyle As New DataGridTableStyle
tableStyle.MappingName = "Points"
DataGrid1.TableStyles.Add(tableStyle)
DataGrid1.TableStyles("Points").GridColumnStyles("X").Width = 0
End Sub