这样不报错:
Select Case e.DataCol.Name
case "部门编码","部门名称"
Dim dr As DataRow
dim bm as string = currenttable.current("部门编码")
Dim ls() as String
ls = bm.split("-")
If bm <> "" Then
If ls.Length<=1 Then
currenttable.current("部门全称") = currenttable.current("部门名称")
Elseif ls.Length<=2 Then
dr = DataTables("部门表").Find("部门编码 = '" & ls(0) & "'")
if dr IsNot Nothing Then
currenttable.current("部门全称") = dr("部门名称") & "-" & currenttable.current("部门名称")
End If
ElseIf ls.Length<=3 Then
dr = DataTables("部门表").Find("部门编码 = '" & ls(0) & "-" & ls(1) & "'")
if dr IsNot Nothing Then
currenttable.current("部门全称") = dr("部门全称") & "-" & currenttable.current("部门名称")
End If
End if
End If
End Select
[此贴子已经被作者于2010-5-23 10:46:16编辑过]