如果在当前表(或全局表事件)的PrepareEdit事件写入下列代码:
If e.RecordGrid IsNot Nothing AndAlso e.RecordGrid.Focused Then '如果是在记录窗口输入数据
e.Table.Select(e.Row.Index,e.Col.Index)
End If
那么,分别运行下列2组代码时,提示:“未将对象引用设置到对象的实例”。若再取消上述表事件,仍然提示。实际上代码运行了,也达到了效果,但不知道哪里出了错。
1-------
For Each dt As DataTable In DataTables
For Each a As OBJECT In Tables(dt.name).grid.parent.controls
For Each b As OBJECT In a.controls
output.show(b.text)
b.font = New Font("楷体",14)
Next
Next
Next
2------
For Each tb As Table In Tables '表窗口
'Dim tb As Table = Tables("样例")
Dim rng As C1.Win.C1FlexGrid.CellRange = tb.Grid.GetCellRange(0, 1, 0, tb.cols.Count)
Dim cs1 As C1.Win.C1FlexGrid.CellStyle = tb.Grid.Styles.Add("样式1")
cs1.Font = new font("宋体", 9)
rng.style = cs1
Next