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("Num bered", GetType(Integer ))
daCustomer.Fill (ds, "Clients")
ds.Tables("Clie nts").Columns.A dd(dcNew)
Dim x As Integer
For x = 0 To ds.Tables("Clie nts").Rows.Coun t - 1
Dim dr As DataRow = ds.Tables("Clie nts").Rows(x)
dr.BeginEdit()
dr.Item("Number ed") = x
dr.EndEdit()
Next
SetupData()
To add a table style
Private Sub SetupData()
Dim ts As New DataGridTableSt yle
ts.MappingName = "Clients"
Dim col As New DataGridTextBox Column
With col
..MappingName = "Numbered"
..HeaderText = "Numbered"
..Width = 50
End With
Dim colPhone As New DataGridTextBox Column
With colPhone
..MappingName = "PhoneNumbe r"
..HeaderText = "Phone Number"
..Width = 200
End With
Dim colName As New DataGridTextBox Column
With colName
..MappingName = "LastName"
..HeaderText = "Name"
..Width = 250
End With
ts.GridColumnSt yles.Add(col)
ts.GridColumnSt yles.Add(colPho ne)
ts.GridColumnSt yles.Add(colNam e)
DataGrid1.Table Styles.Add(ts)
ts = Nothing
colPhone = Nothing
colName = Nothing
End Sub
Ken
-----------------
"Mike Fellows" <mi************ *@equityhouse.c o.uk.SPAM> wrote in message
news:RX******** *******@newsfep 3-gui.server.ntli .net...
I want to add a fresh column to a datagrid that is bound to a datasource
i want it to be the first column on the datagrid so that i can number each
row 1,2,3,4.... etc. (but i have no need to store this within my database)
how do i add an empty column?
Thanks
Mike Fellows