例子上传来测试。
Select Case e.DataCol.Name
Case "姓名","项目","规格"
Dim n1 As Integer
Dim Lms,py,jps As String
Dim jps1 As New List(Of String)
Lms ="姓名|项目|规格"
For Each py In Lms.split("|")
If py =e.DataCol.Name Then
Exit For
End If
n1+=1
Next
If e.DataRow.Isnull(e.DataCol.Name) Then
py ="@|#|$".split("|")(n1)
Else
py = GetPY(e.DataRow(e.DataCol.Name),True)
End If
If e.DataRow.isnull("简拼") = False Then
jps1.AddRange(e.DataRow("简拼").split("|"))
Else
jps1.AddRange("@|#|$".split("|"))
End If
jps1.Insert(n1,py)
jps1.RemoveAt(n1+1)
For Each py In jps1
jps+=py & "|"
Next
e.DataRow("简拼") = jps.trim("|")
End Select