txtCostomercode的KEYDOWN事件中写个了判断,当查询得到结果就让txtSevercode获得焦点。可每次查询得到结果后都无法得到焦点,焦点落到其他控件上去了。而如果设了断点跟踪,焦点又可以正常的落在txtSevercode上,求高手指点下是什么原因?如何解决?这是代码,帮忙看看。
       private void txtCostomercode_KeyDown(object sender, KeyEventArgs e)
       {// 如果未查找到记录则让焦点落在txtCostomercode
            if (DataSetUtil.IsNull(dsForInputAll) || DataTableUtil.IsNull(dsForInputAll.Tables[0]))
            {
                MessageBox.Show("未找到该票件的信息", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCostomercode.SelectAll();
                return;
            }
            else
            {
                this.txtSevercode.Focus();//这里设置了获取焦点,可总是得不到焦点,设置断点跟踪又可以正常的的哦啊焦点
             }         }