hi,
i have been strugling with this problem to i can give you somme code of my
project i hop it helps
Private Sub AddCustomDataTableStyle3()
Dim ts1 As New DataGridTableStyle()
ts1.MappingName = "Digitaal"
ts1.ForeColor() = Color.Black
ts1.AlternatingBackColor = System.Drawing.Color.LightGray
ts1.BackColor = System.Drawing.Color.DarkGray
ts1.ForeColor = System.Drawing.Color.Black
ts1.GridLineColor = System.Drawing.Color.Black
ts1.GridLineStyle = System.Windows.Forms.DataGridLineStyle.None
ts1.HeaderBackColor = System.Drawing.Color.Silver
ts1.HeaderForeColor = System.Drawing.Color.Black
ts1.LinkColor = System.Drawing.Color.Navy
ts1.SelectionBackColor = System.Drawing.Color.Navy
ts1.SelectionForeColor = System.Drawing.Color.White
//This part sets up the wole datagridstyle
Dim boolCol As New DataGridBoolColumn()
boolCol.MappingName = "State"
boolCol.HeaderText = ""
boolCol.Width = 15
ts1.GridColumnStyles.Add(boolCol)
Dim NameCol As New DataGridTextBoxColumn()
NameCol.MappingName = "Channel"
NameCol.HeaderText = "Chan"
NameCol.Width = 40
ts1.GridColumnStyles.Add(NameCol)
DataGrid3.TableStyles.Add(ts1)
TablesAlreadyAdded = True
Dim ChannelCol As New DataGridTextBoxColumn()
ChannelCol.MappingName = "Name"
ChannelCol.HeaderText = "Name"
ChannelCol.Width = 100
ts1.GridColumnStyles.Add(ChannelCol)
DataGrid3.TableStyles.Add(ts1)
TablesAlreadyAdded = True
//this part ads the collumn 1 chechbox collumn, and 2 textbox collumns
Private Sub MakeDataSe3t()
myDataSet3 = New DataSet("myDataSet")
Dim cont As New DataTable("Digitaal")
Dim Name As New DataColumn("Name", GetType(String))
Dim Channel As New DataColumn("Channel")
Dim Status As New DataColumn("State", GetType(Boolean))
cont.Columns.Add(Status)
cont.Columns.Add(Name)
cont.Columns.Add(Channel)
myDataSet3.Tables.Add(cont)
Dim newRow1 As DataRow
For inti = 0 To 15
newRow1 = cont.NewRow()
newRow1("Name") = dchanName(inti + 1)
cont.Rows.Add(newRow1)
cont.Rows(inti)("Channel") = inti + 1
cont.Rows(inti)("State") = (False)
Next inti
End Sub
i don't fill up the grid by coupling it with a database, but fil it like the
above way
what's important, is that you use the correct mappingname to link yourre
dataset to the datatable.
I hope it helped
kind regards Maarten