试试这个(放在datacolchanged事件中):
dim bm as string = currenttable.current("部门编码")
Dim ls() as String
ls = bm.split("-")
If bm <> "" Then
Select Case ls.Length
Case 1
currenttable.current("部门全称") = currenttable.current("部门名称")
Case 2
Dim dr As DataRow
dr = DataTables("部门表").Find("部门编码 = '" & ls(0) & "'")
currenttable.current("部门全称") = dr("部门名称") & "-" & currenttable.current("部门名称")
Case 3
Dim dr As DataRow
dr = DataTables("部门表").Find("部门编码 = '" & ls(0) & "-" & ls(1) & "'")
currenttable.current("部门全称") = dr("部门全称") & "-" & currenttable.current("部门名称")
End Select
End If
[此贴子已经被作者于2010-5-23 10:07:24编辑过]