当我从文本框移动到c#中的下一个代码时如何执行代码?

时间:2015-10-28 06:15:41

标签: c#

在我的程序中我创建了文本框,其中一个是FileNo_txt,所以当我移动到另一个文本框时,我想检查数据库中是否存在该文件编号?

enter image description here

2 个答案:

答案 0 :(得分:0)

您需要订阅文本框的Leave事件。

private void FileNo_txt_Leave(object sender, System.EventArgs e)
{
    //check if that file number is exist in the database or not

    //PatientName_txt.Focus(); if you want to automatically focus any textbox
}

了解更多信息 Try this

答案 1 :(得分:0)

private void FileNo_txt_Leave(object sender, System.EventArgs e)
{
     //check if that file number is exist in the database or not.

}

还在构造函数中添加此行(表单构造函数)

this.FileNo_txt.Leave+= new System.EventHandler(this.FileNo_txt_Leave);
相关问题