create the calculator that compares the two values that user enters and then has a message box displaying true or false. The radio buttons should include <,<=,>,>=,=,<>
This is the instruction.
I made a code but the problem is that more than one message box show when I click the other button after I click the first one. For example, when I click <
button first it shows a message box, then I click >
button, 2 message box come up.
Could you also show the form? I am not sure if mine is right(two text boxes on the side and radio buttons in between them). Thank you.
This is my code.
Public Class Form1
Dim x, y As Double
Private Sub radlessthan_CheckedChanged(sender As Object, e As EventArgs Handles radlessthan.CheckedChanged
x = txtfirstnumber.Text
y = txtfirstnumber.Text
If x < y Then
MessageBox.Show(True)
End If
MessageBox.Show(False)
End Sub
Private Sub radlessthanorequalto_CheckedChanged(sender As Object, e As EventArgs) Handles radlessthanorequalto.CheckedChanged
x = txtfirstnumber.Text
y = txtfirstnumber.Text
If x <= y Then
MessageBox.Show(True)
End If
MessageBox.Show(False)
End Sub
Private Sub radgreaterthan_CheckedChanged(sender As Object, e As EventArgs) Handles radgreaterthan.CheckedChanged
x = txtfirstnumber.Text
y = txtfirstnumber.Text
If x > y Then
MessageBox.Show(True)
End If
MessageBox.Show(False)
End Sub
Private Sub radgreaterthanorequalto_CheckedChanged(sender As Object, e As EventArgs) Handles radgreaterthanorequalto.CheckedChanged
x = txtfirstnumber.Text
y = txtfirstnumber.Text
If x >= y Then
MessageBox.Show(True)
ElseIf x < y Then
MessageBox.Show(False)
End If
End Sub
Private Sub radequalto_CheckedChanged(sender As Object, e As EventArgs) Handles radequalto.CheckedChanged
x = txtfirstnumber.Text
y = txtfirstnumber.Text
If x = y Then
MessageBox.Show(True)
ElseIf x <> y Or x > y Or x < y Then
MessageBox.Show(False)
End If
End Sub
Private Sub radnotequalto_CheckedChanged(sender As Object, e As EventArgs) Handles radnotequalto.CheckedChanged
x = txtfirstnumber.Text
y = txtfirstnumber.Text
If x <> y Then
MessageBox.Show(True)
ElseIf x = y Or x >= y Or x <= y Then
MessageBox.Show(False)
End If
End Sub