Dim gsm As String = e.Form.Controls("ComboBox1").value
Dim s() As String
s = New String() {"A","B","C","D","E","F","G","H","I","J","K"}
Dim je As Double
Dim dr4 As DataRow
For Index As Integer = 0 To s.Length - 1
dr4 = DataTables("表A").Find("单位 = '" & gsm & "' and 名称 = '" & s(Index) & "'")
If dr IsNot Nothing Then
If Index = 0 Then
je = dr4("余额")
ElseIf Index > 0 And Index < 4 Then
je = je - dr4("余额")
ElseIf Index = 4 Or Index = 5 Then
je = je + dr4("余额")
ElseIf Index > 5 And Index < 9 Then
je = je + dr4("余额")
ElseIf Index >= 9 Then
je = je + dr4("余额")
End If
MessageBox.Show(je)
Else
MessageBox.Show("找不到")
End If
Next
在表“表A”,“名称”列中,A、C、E 和 F 都是存在的,但是就是每一个找到,请问狐爸,我上面的代码那里出错了?谢谢