' Visual Basic
Private Sub CreateAuthorFirstNameColumn()
' Add a GridTableStyle and set the MappingName
' to the name of the DataTable.
Dim TSAuthors As New DataGridTableStyle()
TSAuthors.MappingName = "Authors"
' Add a GridColumnStyle and set the MappingName
' to the name of a DataColumn in the DataTable.
' Set the HeaderText and Width properties.
Dim TCFirstName As New DataGridTextBoxColumn()
TCFirstName.MappingName = "AV_FName"
TCFirstName.HeaderText = "First Name"
TCFirstName.Width = 75
TSAuthors.GridColumnStyles.Add(TCFirstName)
' Add the DataGridTableStyle instance to
' the GridTableStylesCollection.
myDataGrid.TableStyles.Add(TSAuthors)
End Sub