Jump to content

RadioButons with elsif

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
kenex

kenex

    Learning Programmer

  • Members
  • PipPipPip
  • 32 posts
public Class mathest
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim variable1 As Double
Dim variable2 As Double
If RadioButton1.Checked = True Then
TextBox3.Text = variable1 \ variable2
ElseIf RadioButton2.Checked = True Then
TextBox3.Text = variable1 Mod variable2
ElseIf RadioButton3.Checked = True Then
TextBox3.Text = variable1 ^ variable2
ElseIf RadioButton4.Checked = True Then
TextBox3.Text = variable1 & variable2
End If
End Sub
Private Sub cmdclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdclear.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Private Sub cmdquit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdquit.Click
Me.Close()
End Sub
End Class
pls i need help in the above programme.
when i run the program,it will display -DivideByZeroExcePtion was unhandled

#2
CommittedC0der

CommittedC0der

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,565 posts

Quote

public Class mathest
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim variable1 As Double
Dim variable2 As Double
If RadioButton1.Checked = True Then
TextBox3.Text = variable1 \ variable2
ElseIf RadioButton2.Checked = True Then
TextBox3.Text = variable1 Mod variable2
ElseIf RadioButton3.Checked = True Then
TextBox3.Text = variable1 ^ variable2
ElseIf RadioButton4.Checked = True Then
TextBox3.Text = variable1 & variable2
End If
End Sub
Private Sub cmdclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdclear.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Private Sub cmdquit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdquit.Click
Me.Close()
End Sub
End Class
pls i need help in the above programme.
when i run the program,it will display -DivideByZeroExcePtion was unhandled
First please use the [code ] [/ code] tags. The problem is, variable1 and variable2 are declared but have no value try this:
Dim variable1 As Double = 1
        Dim variable2 As Double = 1
Which should work. :)
A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.

#3
kenex

kenex

    Learning Programmer

  • Members
  • PipPipPip
  • 32 posts
Thanx, it works:thumbup1:

#4
CommittedC0der

CommittedC0der

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,565 posts
No prob. :)
A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.