-2
Я продолжаю получать несколько MsgBoxes с теми же сообщениями об ошибках. Как мне это избежать?Несколько MsgBoxes
Private Sub BtnCalc_Click(sender As Object, e As EventArgs) Handles BtnCalc.Click
Dim intValue1 As Integer
Dim intValue2 As Integer
Dim intValue3 As Integer
intValue1 = Val(TBValue1.Text)
intValue2 = Val(TBValue2.Text)
intValue3 = Val(TBValue3.Text)
If IsNumeric(Val(TBValue1.Text)) Then
If IsNumeric(Val(TBValue2.Text)) Then
If Val(TBValue1.Text) > 0 Then
If Val(TBValue2.Text) > 0 Then
If Val(TBValue1.Text) <> "" Then
If Val(TBValue2.Text) <> "" Then
TBValue3.Text = a + ((Val(TBValue1.Text) - >Val(TBValue2.Text)) * 10)
If Val(TBValue1.Text) > Val(TBValue2.Text) + x
Then MsgBox("Error2")
End If
Else : MsgBox("Error!")
TBValue1.Text = ""
TBValue2.Text = ""
TBValue3.Text = ""
End If
Else : MsgBox("Error!")
TBValue1.Text = ""
TBValue2.Text = ""
TBValue3.Text = ""
End If
Else : MsgBox("Error!")
TBValue1.Text = ""
TBValue2.Text = ""
TBValue3.Text = ""
End If
Else : MsgBox("Error!")
TBValue1.Text = ""
TBValue2.Text = ""
TBValue3.Text = ""
End If
MsgBox("Error!")
TBValue1.Text = ""
TBValue2.Text = ""
TBValue3.Text = ""
End If
MsgBox("Error!")
TBValue1.Text = ""
TBValue2.Text = ""
TBValue3.Text = ""
End If
End Sub
End Class
Это заставило мои глаза кровоточат, но последние два MsgBox() вызовы принадлежат внутри Else блока. Не пишите такой код. –