关于cell的文字全选
在某cell校验出错时,报完message后想把出错的cell的文字全选,请问该如何处理? 回复 1楼Kissmint的帖子你可以尝试下如下代码:
void gcMultiRow1_CellValidating(object sender, CellValidatingEventArgs e)
{
if (e.FormattedValue is string && (e.FormattedValue as string).Length > 5)
{
MessageBox.Show("Text is too long!");
if (gcMultiRow1.IsCurrentCellInEditMode)
{
if (gcMultiRow1.EditingControl is IEditingControl)
{
(gcMultiRow1.EditingControl as IEditingControl).PrepareEditingControlForEdit(true);
}
}
else
{
gcMultiRow1.BeginEdit(true);
}
e.Cancel = true;
}
}
页:
[1]