在 学生成绩表 中的 DataColChanged 事件中加入下面代码即可
Select Case e.DataCol.Name
Case "学号"
If e.NewValue Is Nothing Then '如果新值是空白,也就是姓名列的内容为空
e.DataRow("姓名") = Nothing
Else
Dim dr As DataRow = DataTables("学生档案").find("学号 = " & e.DataRow("学号") & "'")
If dr IsNot Nothing Then
e.DataRow("姓名") = dr("姓名")
End If
End if
End Select
[此贴子已经被作者于2016/6/11 22:41:51编辑过]