Hi,
Replace phasetable.rows(x).item(x) = false with
Dim drChange As DataRow = phasetable.Rows(x)
drChange.BeginEdit()
drChange.Item(0) = false
drChange.EndEdit()
Ken
---------------
Ken ,
here is the code
when i open the form the gridbool columns are checked and grayed out
i tried to set them all to false by this command
phasetable.rows(x).item(x) = false
but it did not change neither woudl a true command get anyresults
#Region " Declarations "
Private PhaseGrid As DataGrid = New DataGrid
Private ScoreGrid As DataGrid = New DataGrid
Private MyDSet As DataSet = New DataSet("MyDSet")
Private PhaseTable As DataTable = New DataTable("PhaseTable")
Private ScoreTable As DataTable = New DataTable("ScoreTable")
Private PhaseMember As String = PhaseTable.TableName
Private ScoreMember As String = ScoreTable.TableName
Private PhaseStyle As DataGridTableStyle = New DataGridTableStyle
Private PhaseRows(9) As DataRow
Private PhaseColStyle As DataGridTextBoxColumn = New DataGridTextBoxColumn
#End Region
Public Sub New(ByVal Players() As String)
Load_PhaseTable(Players)
End Sub
Public Sub Load_PhaseTable(ByVal Players() As String)
MyDSet.Tables.Add(PhaseTable)
Dim Elements() As String = AddElement(Players)
Dim PhaseCols(UBound(Elements)) As DataColumn
Dim PhaseColStyles(UBound(Elements)) As DataGridBoolColumn
Dim CurManager As CurrencyManager
PhaseStyle.MappingName = PhaseTable.TableName
PhaseGrid.TableStyles.Add(PhaseStyle)
For A As Integer = 0 To UBound(Elements)
PhaseCols(A) = New DataColumn(Elements(A))
PhaseTable.Columns.Add(PhaseCols(A))
If A = 0 Then
PhaseColStyle.MappingName = Elements(A)
PhaseStyle.GridColumnStyles.Add(PhaseColStyle)
PhaseColStyle.HeaderText = "Phase"
PhaseColStyle.Alignment = HorizontalAlignment.Center
PhaseColStyle.Width = 60
Else
PhaseColStyles(A) = New DataGridBoolColumn
PhaseColStyles(A).MappingName = Elements(A)
PhaseStyle.GridColumnStyles.Add(PhaseColStyles(A))
PhaseColStyles(A).HeaderText = Elements(A).Substring(0, 4)
PhaseColStyles(A).Alignment = HorizontalAlignment.Center
PhaseColStyles(A).Width = 30
PhaseColStyles(A).TrueValue = True
PhaseColStyles(A).FalseValue = False
PhaseColStyles(A).NullValue = Convert.DBNull
PhaseColStyles(A).NullText = False
End If
Next
For B As Integer = 0 To 9
PhaseRows(B) = PhaseTable.NewRow
PhaseTable.Rows.Add(PhaseRows(B))
Next
Dim PhaseGridCell(9, UBound(Elements)) As DataGridCell
For C As Integer = 0 To UBound(Elements)
For D As Integer = 0 To 9
PhaseGridCell(D, C) = New DataGridCell(D, C)
Next
Next
PhaseGrid.SetDataBinding(MyDSet, PhaseMember)
End Sub
Private Function AddElement(ByVal Element() As String) As String()
Dim Added(UBound(Element) + 1) As String
Added.SetValue("Phase", 0)
Element.CopyTo(Added, 1)
Return Added
End Function
Private Sub Score_Board_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Controls.Add(PhaseGrid)
PhaseGrid.Show()
PhaseGrid.Location = New Point(0, 0)
PhaseGrid.Height = 220
PhaseGrid.Width = 400
PhaseGrid.BorderStyle = BorderStyle.None
End Sub
End Class