ok i found some code to setup the table, and se collums.
but how can add some cource.
i tried to do so, but the styles do not effect the grid.
this is what i did.
Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
FormatGridWithBothTableAndColumnStyles()
addata()
End Sub
Private Sub FormatGridWithBothTableAndColumnStyles()
With DataGrid1
..BackColor = Color.GhostWhite
..BackgroundColor = Color.Lavender
..BorderStyle = BorderStyle.None
..CaptionBackColor = Color.RoyalBlue
..CaptionFont = New Font("Tahoma", 10.0!, FontStyle.Bold)
..CaptionForeColor = Color.Bisque
..CaptionText = "Northwind Products"
..Font = New Font("Tahoma", 8.0!)
..ParentRowsBackColor = Color.Lavender
..ParentRowsForeColor = Color.MidnightBlue
..DataSource() = D
End With
Dim grdTableStyle1 As New DataGridTableStyle()
With grdTableStyle1
..AlternatingBackColor = Color.GhostWhite
..BackColor = Color.GhostWhite
..ForeColor = Color.MidnightBlue
..GridLineColor = Color.RoyalBlue
..HeaderBackColor = Color.MidnightBlue
..HeaderFont = New Font("Tahoma", 8.0!, FontStyle.Bold)
..HeaderForeColor = Color.Lavender
..SelectionBackColor = Color.Teal
..SelectionForeColor = Color.PaleGreen
..MappingName = "Controler"
..PreferredColumnWidth = 125
..PreferredRowHeight = 15
End With
Dim grdColStyle1 As New DataGridBoolColumn()
With grdColStyle1
..HeaderText = "On/Off"
..MappingName = "ID"
..Width = 50
End With
Dim grdColStyle2 As New DataGridTextBoxColumn()
With grdColStyle2
..HeaderText = "Name"
..MappingName = "ChannelName"
End With
Dim grdColStyle3 As New DataGridTextBoxColumn()
With grdColStyle3
..HeaderText = "Value"
..MappingName = "Value"
..Width = 75
..ReadOnly = True
End With
grdTableStyle1.GridColumnStyles.AddRange(New DataGridColumnStyle()
{grdColStyle1, grdColStyle2, grdColStyle3, grdColStyle4})
DataGrid1.TableStyles.Add(grdTableStyle1)
End Sub
Private Sub addata()
Public D As New DataTable()
D.Columns.Add("Channel")
D.Columns.Add("Name")
D.Columns.Add("Value")
R = D.NewRow
R.Item(0) = true
R.Item(1) = dchanName(e.Index + 1)
R.Item(2) = dchanState(e.Index + 1)
R.Item(3) = dchanPos(e.Index + 1)
D.Rows.Add(R)
End Sub
i know this can't work, becouse when i add the code, i generate a datatable
independent from the table i created.
but how can i add the last items, so the get places in the formated
collumns
kind regard, and sorry i keep on troubeling you with probably stupid
questions.
Maarten