下面代码,能优化吗?这样写很长
'3列修改同步修改
Select Case e.DataCol.Name
Case "第一列","第二列","第三列"
If e.DataCol.Name = "第一列" Then
If e.NewValue Is Nothing Then
e.DataRow("第二列") = Nothing
e.DataRow("第三列") = Nothing
Else
Dim dr As DataRow = e.DataRow
If dr.IsNull("第一列") = False Then '身份证号码是否为空
dr("第二列") = dr("第一列")
dr("第三列") = dr("第一列")
End If
End If
End If
If e.DataCol.Name = "第二列" Then
If e.NewValue Is Nothing Then
e.DataRow("第一列") = Nothing
e.DataRow("第三列") = Nothing
Else
Dim dr As DataRow = e.DataRow
If dr.IsNull("第二列") = False Then '身份证号码是否为空
dr("第二列") = dr("第二列")
dr("第三列") = dr("第二列")
End If
End If
End If
If e.DataCol.Name = "第三列" Then
If e.NewValue Is Nothing Then
e.DataRow("第二列") = Nothing
e.DataRow("第一列") = Nothing
Else
Dim dr As DataRow = e.DataRow
If dr.IsNull("第三列") = False Then '身份证号码是否为空
dr("第二列") = dr("第三列")
dr("第一列") = dr("第三列")
End If
End If
End If
End Select