找回密码
 立即注册

QQ登录

只需一步,快速开始

Johnnyfan0417

注册会员

2

主题

3

帖子

26

积分

注册会员

积分
26
最新发帖
Johnnyfan0417
注册会员   /  发表于:2018-9-18 09:30  /   查看:3321  /  回复:3
请问现在有一个检验要求是金额单元格失去焦点时,判断金额如果为空或者0便把单元格的值设为0,并且结束这个事件。第二种情况是通过一个自己写的check方法,如果返回值不为0,则把金额单元格内容设为0,并且设置焦点在这个单元格,然后事件结束。
我想请问这两个操作应该写在哪种事件中?我现在写在了cellvalidating里,但是发现我给单元格设值后,写了return后,焦点不移走,同样单元格的值也没有设为0。请教各位大神,这种情况应该怎么写

3 个回复

倒序浏览
JeffryLI
葡萄城公司职员   /  发表于:2018-9-21 10:46:35
沙发
您好,请参照
  1. this._gcMultiRow.CellValidating += (s, e) =>
  2.             {
  3.                 var gcMultiRow = s as GcMultiRow;
  4.                 if (gcMultiRow == null || gcMultiRow.EditingControl == null)
  5.                 {
  6.                     return;
  7.                 }

  8.                 var currentValue = gcMultiRow.EditingControl.Text;
  9.                 int result;
  10.                 if (int.TryParse(currentValue, out result))
  11.                 {
  12.                     if (result > 10)
  13.                     {
  14.                         gcMultiRow.EditingControl.Text = "0";
  15.                     }
  16.                 }
  17.             };
复制代码
请点击评分,对我5分评价,谢谢!

葡萄城控件服务团队
官方网站: https://www.grapecity.com.cn/developer
回复 使用道具 举报
Johnnyfan0417
注册会员   /  发表于:2018-9-27 16:33:13
板凳
多谢,已解决
回复 使用道具 举报
JeffryLI
葡萄城公司职员   /  发表于:2018-10-12 13:37:08
地板
不客气的
请点击评分,对我5分评价,谢谢!

葡萄城控件服务团队
官方网站: https://www.grapecity.com.cn/developer
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部