找回密码
 立即注册

QQ登录

只需一步,快速开始

wahaha

社区贡献组

44

主题

101

帖子

2723

积分

社区贡献组

积分
2723

活字格认证

wahaha
社区贡献组   /  发表于:2014-1-29 09:41  /   查看:4241  /  回复:1
Hi guys, I'm trying to use FormulaTextBox to allow the user enter their custom formula, is there a way that we can keep the focus on the FormulaTextBox after the user enter an invlid formula and press enter key?


代发帖

1 个回复

倒序浏览
roger.wang
社区贡献组   /  发表于:2014-1-29 11:57:00
沙发
回复 1楼wahaha的帖子

可通过formulaTextBox1_Leave事件判断:

  1. private void formulaTextBox1_Leave(object sender, EventArgs e)
  2.         {
  3.             string txt = fpSpread1.ActiveSheet.ActiveCell.Text;
  4.             if (txt == "#NAME?" || txt == "#DIV/0!" || txt == "#REF!")
  5.             {
  6.                 formulaTextBox1.Focus();
  7.             }         
  8.             return;      
  9.         }
复制代码
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部