Mike,
You need to add a datacolumn to the datatable you are showing in the
datagrid. Add a tablestyle to the datagrid to adjust the order the columns
are displayed.
To add a column to data table
Dim dcNew As New DataColumn("Numbered", GetType(Integer))
daCustomer.Fill(ds, "Clients")
ds.Tables("Clients").Columns.Add(dcNew)
Dim x As Integer
For x = 0 To ds.Tables("Clients").Rows.Count - 1
Dim dr As DataRow = ds.Tables("Clients").Rows(x)
dr.BeginEdit()
dr.Item("Numbered") = x
dr.EndEdit()
Next
SetupData()
To add a table style
Private Sub SetupData()
Dim ts As New DataGridTableStyle
ts.MappingName = "Clients"
Dim col As New DataGridTextBoxColumn
With col
..MappingName = "Numbered"
..HeaderText = "Numbered"
..Width = 50
End With
Dim colPhone As New DataGridTextBoxColumn
With colPhone
..MappingName = "PhoneNumber"
..HeaderText = "Phone Number"
..Width = 200
End With
Dim colName As New DataGridTextBoxColumn
With colName
..MappingName = "LastName"
..HeaderText = "Name"
..Width = 250
End With
ts.GridColumnStyles.Add(col)
ts.GridColumnStyles.Add(colPhone)
ts.GridColumnStyles.Add(colName)
DataGrid1.TableStyles.Add(ts)
ts = Nothing
colPhone = Nothing
colName = Nothing
End Sub
Ken