以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]请大神帮忙修改代码!  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=30903)

--  作者:sadfox
--  发布时间:2013/4/6 16:10:00
--  [求助]请大神帮忙修改代码!

考核表事件代码

Select Case e.DataCol.name
    Case "姓名"
        Dim dr As DataRow = DataTables("员工资料").Find("[姓名] = \'" & e.DataRow("姓名") & "\'")
        If dr IsNot Nothing Then
            e.DataRow("文档号") =  dr("文档号")
        End If
        If dr Is Nothing Then
            MessageBox.Show("警告!输入姓名错误,查无此人")
        End If
End Select

怎么样才能让输入姓名错误的时候才提示,删除内容,当考核表姓名栏的单元格变为空值的时候不提示!


--  作者:fjlclxj
--  发布时间:2013/4/6 16:27:00
--  
Select Case e.DataCol.name
    Case "姓名"
if e.DataRow("姓名")<>"" then
Dim dr As DataRow = DataTables("员工资料").Find("[姓名] = \'" & e.DataRow("姓名") & "\'")
If dr IsNot Nothing Then e.DataRow("文档号") =  dr("文档号")
If dr Is Nothing Then MessageBox.Show("警告!输入姓名错误,查无此人")
        End If
End Select
不晓得是不是这样?

--  作者:sadfox
--  发布时间:2013/4/6 16:40:00
--  
谢谢,我去试试
--  作者:sadfox
--  发布时间:2013/4/6 16:44:00
--  
可以了,能告诉我if e.DataRow("姓名")<>"" then这句是什么意思吗?
--  作者:泡泡
--  发布时间:2013/4/6 16:47:00
--  
以下是引用sadfox在2013-4-6 16:44:00的发言:
可以了,能告诉我if e.DataRow("姓名")<>"" then这句是什么意思吗?

就是当“姓名”有值时


--  作者:sadfox
--  发布时间:2013/4/6 17:02:00
--  
以下是引用泡泡在2013-4-6 16:47:00的发言:

就是当“姓名”有值时

感谢,明白了!