我有一个用 DataTable 填充的 ComponentOne FlexGrid。每个 DataTable 列都在此网格中分配了自己的列,但还有一个附加列(在设计器中声明)配置为带有复选框(布尔类型)的单元格,用户将在之后选择值。
我用 for 循环填充网格:
With My_StoreProcedure()
For I As Integer = 1 To .Rows.Count()
gridDates.Item(I, cPatron)= .Rows(I - 1).Item("patron")
gridDates.Item(I, cColumn2)= .Rows(I - 1).Item("anothercolum2")
gridDates.Item(I, cColumn3)= .Rows(I - 1).Item("anothercolum3")
[..other 3 columns more...]
Next I
然后用户从获得的网格结果中选择复选框,点击“获取”按钮,该按钮调用包含另一个循环的方法,我有这个内部循环来获取值:
With gridDates
For I As Integer = 1 To .Rows.Count() - 1
'Dim celda As Object = gridDates.Item(I, 8)
'Here it is where it doesn't work:
Dim value As C1.Win.C1FlexGrid.CheckEnum = .GetCellCheck(I, columnwithCheck)
If value = C1.Win.C1FlexGrid.CheckEnum.TSChecked Then
Dim patron As String = gridDates.Item(I, 1).ToString
Dim value2 As String = gridDates.Item(I, 2).ToString
Dim value3 As Char = CChar(gridDates.Item(I, 3))
[some other values...]
StoreSave(patron, value2, value3, ...)
End If
Next I
End With
我设置了一个断点,发现我得到一个空对象,它没有得到任何复选框的当前值。
如何以正确的方式检索该值?
编辑:我刚刚在设计器中添加了与网格相关的代码:
'
'gridDates
'
Me.gridDates.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
Me.gridDates.AllowFreezing = C1.Win.C1FlexGrid.AllowFreezingEnum.Both
Me.gridDates.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.None
Me.gridDates.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
Me.gridDates.ColumnInfo = resources.GetString("gridDates.ColumnInfo")
Me.gridDates.ExtendLastCol = True
Me.gridDates.KeyActionEnter = C1.Win.C1FlexGrid.KeyActionEnum.MoveAcross
Me.gridDates.Location = New System.Drawing.Point(12, 104)
Me.gridDates.Name = "gridDates"
Me.gridDates.Rows.Count = 500
Me.gridDates.Rows.DefaultSize = 19
Me.gridDates.SelectionMode = C1.Win.C1FlexGrid.SelectionModeEnum.Row
Me.gridDates.Size = New System.Drawing.Size(742, 261)
Me.gridDates.StyleInfo = resources.GetString("gridDates.StyleInfo")
Me.gridDates.TabIndex = 1