参考代码
Dim str As String = "aaa(bbbccdd(efg)999999"
Dim ls As new List(Of String)
For Each s As String In str
If s = "(" Then
ls.add("(")
ElseIf s = ")" Then
If ls.count > 0 AndAlso ls(ls.count-1) = "(" Then
ls.RemoveAt(ls.count-1)
Else
msgbox("多了),不匹配")
Exit For
End If
End If
Next
msgbox("不匹配括号:" & String.join(",",ls.ToArray))