DataColChanged
Select Case e.DataCol.name
Case "案号"
Dim str As String = e.DataRow("案号")
Dim mc = System.Text.RegularExpressions.Regex.Matches(str, "(?<=\()[0-9]+?(?=\))")
If mc.count>0 Then
e.DataRow("年度列") = mc(0).value
Else
e.DataRow("年度列") = Nothing
End If
If str.Contains("民初") Then
e.DataRow("类别") = "AMC"
ElseIf str.Contains("民监")Then
e.DataRow("类别") = "AMJ"
ElseIf str.Contains("民申") Then
e.DataRow("类别") = "AMS"
Else
e.DataRow("类别") = Nothing
End If
Case "年度列"
If e.DataRow("年度列") > "" AndAlso e.DataRow("年度列").length >= 4 Then
Dim bh As String = e.DataRow("年度列").Substring(2) & Format(Date.Today, "MMdd")
If e.DataRow("流水号").contains(bh) = False Then
Dim max As String = e.DataTable.Compute("max(流水号)", "流水号 like '" & bh & "%'")
Dim i As Integer = 1
If max > "" Then
i = max.SubString(bh.Length)+11
End If
e.DataRow("流水号") = bh & format(i, "0000")
End If
End If
End Select