谢谢Hyphen老师的指教,对案例进行修改,现在可以正常打开。但是存在一个问题,在窗口TextBox3控件,输入错误的账号后,如果不关闭窗口,重新输入正确账号,就会出现错误(错误信息如下),一定要重新打开项目输入正确账号才行。如何修改代码,使其不出错(重新上传案例)。请各位老师指教,谢谢!
.NET Framework 版本:2.0.50727.8670
Foxtable 版本:2016.4.6.1
错误所在事件:窗口,用户登录,TextBox3,TextChanged
详细错误信息:
未将对象引用设置到对象的实例。
窗口TextBox3控件TextChanged事件的代码:
If e.Form.Controls("TextBox3").Text <> "" Then
Dim tx As WinForm.TextBox = e.Sender
If tx.Text.Length = 4 Then
Dim id As String = e.Form.Controls("TextBox3").Text
Dim pr As DataRow = DataTables("用户信息").Find("账号 = '"& id &"'")
If pr IsNot Nothing Then
e.Form.Controls("TextBox1").Value = pr("姓名")
e.Form.Controls("TextBox2").Value = pr("部门")
e.Form.Controls("TextBox4").Select()
Else
e.Form.Controls("TextBox3").Value = Nothing
e.Form.Controls("TextBox3").Select()
PopMessage("对应的用户不存在!","提示",PopIconEnum.Infomation,5)
Return
End If
End If
End If