找回密码
 立即注册

QQ登录

只需一步,快速开始

Kissmint

银牌会员

18

主题

36

帖子

2730

积分

银牌会员

积分
2730

活字格认证

Kissmint
银牌会员   /  发表于:2015-2-27 21:42  /   查看:4487  /  回复:1
在某cell校验出错时,报完message后想把出错的cell的文字全选,请问该如何处理?

1 个回复

倒序浏览
Alice
社区贡献组   /  发表于:2015-2-28 11:09:00
沙发
回复 1楼Kissmint的帖子

你可以尝试下如下代码:
  1.   void gcMultiRow1_CellValidating(object sender, CellValidatingEventArgs e)
  2.         {
  3.             if (e.FormattedValue is string && (e.FormattedValue as string).Length > 5)
  4.             {
  5.                 MessageBox.Show("Text is too long!");
  6.                 if (gcMultiRow1.IsCurrentCellInEditMode)
  7.                 {
  8.                     if (gcMultiRow1.EditingControl is IEditingControl)
  9.                     {
  10.                         (gcMultiRow1.EditingControl as IEditingControl).PrepareEditingControlForEdit(true);
  11.                     }
  12.                 }
  13.                 else
  14.                 {
  15.                     gcMultiRow1.BeginEdit(true);
  16.                 }
  17.                 e.Cancel = true;
  18.             }
  19.         }
复制代码
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部