DataColChanging事件:
If e.DataCol.Name = "住院号" Then
If e.NewValue IsNot Nothing Then
Dim vals() As String = e.NewValue.split(":")
If vals.length > 2 Then
e.NewValue =vals(2)
Else
e.NewValue =vals(0)
End If
End If
End If
DataCoChanged事件:
If e.DataCol.Name = "住院号" Then
If e.DataRow.Isnull("住院号") Then
e.DataRow("患者姓名") = Nothing
Else
Dim dr As DataRow = DataTables("入院登记").Find("[住院号] = '" & e.DataRow("住院号") & "'")
If dr IsNot Nothing Then
e.DataRow("患者姓名") = dr("患者姓名")
Else
MsgBox("项目不存在,请重新输入!",64,"提示")
e.DataRow("患者姓名") = Nothing
End If
End If
End If