【发布时间】:2017-02-01 16:16:49
【问题描述】:
我正在尝试在我的UltraGrid 中添加一些验证,如果用户在一个单元格中键入一个值,但没有将CheckBoxColumn 的值设置为True,则会显示MessageBox并且该单元格中的文本/值被清除,再次留下一个空白单元格。
到目前为止我所拥有的是:
Try
If e.Cell.Column.Key = "Commission_Rate" Then
If e.Cell.Row.Cells("Commission_Override").Value = False Then
MessageBox.Show("Before entering a custom rate, please set 'Commission Override' to True", "Override Commission", MessageBoxButtons.OK)
e.Cell.Value = ""
End If
End If
Catch
End Try
MessageBox 行工作正常,但是,然后显示另一个说
“无法从:System.String 转换为 System.Decimal”
该单元格是十进制单元格,因为它是用于输入货币值的,那么Decimal的值如何设置为“”?
【问题讨论】:
-
这样的列通常是打字的;在这种情况下,它映射到的 db 列需要一个数字(十进制),因此需要“0”或类似的值。无论如何,DGV 还提供了 RowValidation`,但不清楚它在哪里
-
@Plutonix 加载网格时什么都不显示,有没有办法删除输入的字符?
-
e.Cell.Value = Nothing
-
@Steve 没有返回第二个
MessageBox,但它也没有重置值。
标签: string vb.net decimal infragistics ultrawingrid