既然要通过命令窗口或按钮执行,就删除你原来的代码。
命令窗口或按钮的代码:
For Each dr As DataRow In DataTables("表A").DataRows Dim v As String = dr("wh") If v > "" Then v = v.SubString(v.Indexof("]") +1) v = v.SubString(0,v.LastIndexOf("号")) dr("qw") = v End IfNext