这样呢:
If e.DataCol.Name = "住院号" Then
If e.NewValue = Nothing Then
Else
Dim vals() As String = e.NewValue.split(":")
If vals.length > 2 Then
e.DataRow("住院号") =vals(2)
Else
e.DataRow("住院号") =vals(0)
End If
Dim dr As DataRow = DataTables("入院登记").Find("[住院号] = '" & e.NewValue & "'")
If dr IsNot Nothing Then
e.DataRow("患者姓名") = dr("患者姓名")
Else
MsgBox("项目不存在,请重新输入!",64,"提示")
e.DataRow("患者姓名") = Nothing
End If
End If
End If
或者把:
If e.NewValue = Nothing Then
Else
换成:
If e.DataRow.Isnull("住院号") Then
Else
[此贴子已经被作者于2011-8-5 16:12:43编辑过]