parsing

H

Hemant Bains

if i enter any digit in textbox1 and textbox2 , i do not get the
required result of the arithmetic expression. i am putting the
operator between the operands thro the radio buttons which assign a
operator in the variable "op"
as a string. can somebody help?



Dim op As String


Private Sub RadioButton1_CheckedChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
RadioButton1.CheckedChanged
op = "+"
End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
op = "-"
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
op = "*"
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
op = "/"
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click

Dim myint As Integer
TextBox3.Text = TextBox1.Text & op & TextBox2.Text
' Parse the text from the text boxes.
myint = Integer.Parse(TextBox3.Text)
Label4.Text = myint
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top