以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  未将对象引用设置到对象的实例  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=117534)

--  作者:yetle
--  发布时间:2018/4/14 9:31:00
--  未将对象引用设置到对象的实例

Dim Parts() As String = e.Form.Text.Split("-")
Dim txb1 As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim txb2 As WinForm.TextBox = e.Form.Controls("TextBox2")
Dim txb3 As WinForm.TextBox = e.Form.Controls("TextBox3")
Dim OldUserName As String
OldUserName = Parts(Parts.Length -1)

Dim dr As DataRow =DataTables("用户表").Find("用户名称=\'" & OldUserName & "\'")
Dim dr2 As DataRow=DataTables("用户表").Find("用户名称=\'" & txb1.text & "\'" )
If dr2("_Identify")<> dr("_Identify")Then
MessageBox.show("已存在相同用户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning)
Return
End If
Dim syb As WinForm.RadioButton = e.Form.Controls("RadioButton1")
Dim ymb As WinForm.RadioButton = e.Form.Controls("RadioButton2")
Dim yuga As WinForm.RadioButton = e.Form.Controls("RadioButton3")
Dim jili As WinForm.RadioButton = e.Form.Controls("RadioButton4")
If txb3.text<>txb2.text Then
MessageBox.show("密码输入不一致!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning)
Return
End If
dr("用户名称")=txb1.text
dr("密码")=txb2.text
If syb.Checked=True Then
dr("部门")="销售部"
Else
If ymb.Checked=True Then
dr("部门")="业务部"
End If
End If
If yuga.Checked=True Then
dr("职务")="员工"
Else
If jili.Checked=True Then
dr("职务")="经理"
End If
End If
dr.Save()
If Forms("用户管理").Opened Then
usna="admin"
Else
usna=txb1.text
End If
e.Form.close()


--  作者:wyz20130512
--  发布时间:2018/4/14 9:41:00
--  
要判断一下dr和dr2是否为空。

If dr IsNot Nothing Then

End If

--  作者:有点蓝
--  发布时间:2018/4/14 9:48:00
--  
看看:http://www.foxtable.com/webhelp/scr/2044.htm
--  作者:yetle
--  发布时间:2018/4/14 9:53:00
--  

不对


--  作者:yetle
--  发布时间:2018/4/14 9:58:00
--  
加了判断,还是一样有错误提示
--  作者:wyz20130512
--  发布时间:2018/4/14 10:01:00
--  
上传实例看看
--  作者:有点蓝
--  发布时间:2018/4/14 10:03:00
--  
改了什么地方?还有什么错?改后的代码发上来

不要就只是说有错,这个对解决问题没有任何帮助

--  作者:yetle
--  发布时间:2018/4/14 10:20:00
--  

Dim Parts() As String = e.Form.Text.Split("-")
Dim txb1 As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim txb2 As WinForm.TextBox = e.Form.Controls("TextBox2")
Dim txb3 As WinForm.TextBox = e.Form.Controls("TextBox3")
Dim OldUserName As String
OldUserName = Parts(Parts.Length -1)

Dim dr As DataRow =DataTables("用户表").Find("用户名称=\'" & OldUserName & "\'")
Dim dr2 As DataRow=DataTables("用户表").Find("用户名称=\'" & txb1.text & "\'" )

If dr2("_Identify")<> dr("_Identify")Then
MessageBox.show("已存在相同用户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning)
Return
End If

Dim syb As WinForm.RadioButton = e.Form.Controls("RadioButton1")
Dim ymb As WinForm.RadioButton = e.Form.Controls("RadioButton2")
Dim yuga As WinForm.RadioButton = e.Form.Controls("RadioButton3")
Dim jili As WinForm.RadioButton = e.Form.Controls("RadioButton4")

If txb3.text<>txb2.text Then
MessageBox.show("密码输入不一致!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning)
Return
End If
 
If dr IsNot Nothing Then
dr("用户名称")=txb1.text
dr("密码")=txb2.text
End If
\'If syb.Checked=True Then
\'dr("部门")="销售部"
\'Else
\'If ymb.Checked=True Then
\'dr("部门")="业务部"
\'End If
\'End If
\'If yuga.Checked=True Then
\'dr("职务")="员工"
\'Else
\'If jili.Checked=True Then
\'dr("职务")="经理"
\'End If
\'End If
dr.Save()
End If


If Forms("用户管理").Opened Then
usna="admin"
Else
usna=txb1.text
End If
e.Form.close()

 

提示还是一样

[此贴子已经被作者于2018/4/14 10:20:25编辑过]

--  作者:有点蓝
--  发布时间:2018/4/14 10:39:00
--  

图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看