private void gcMultiRow1_CellValidating(object sender, GrapeCity.Win.MultiRow.CellValidatingEventArgs e)
{
if (e.FormattedValue != null && e.CellName == "textBoxCell1" && e.FormattedValue.ToString().Length > 5)
{
e.Cancel = true;
MessageBox.Show("Error");
}
}
该代码焦点是能回到单元格了,但是我现在需要的是,如果输入长度超过5位,那么原先单元格的内容保持不变,而不是新输入的内容。
gcMultiRow1.item(e.rowindex,e.cellindex).value = gcMultiRow1.item(e.rowindex,e.cellindex).formatedvalue
结果是断点进去后,发现值是原先的值,但是运行完毕之后,发现单元格的值还是后面输入的值。 |
|