I am trying to create a calculator on visual basic for my class project and one equation wont work, The equation is subtract any two numbers from 3 text boxes the code is the following
Public Class Form1
'Declare variable
Dim FirstNum, SecondNum, ThirdNum As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Assign textbox values to variables
FirstNum = TextBox1.Text
SecondNum = TextBox2.Text
ThirdNum = TextBox3.Text
If TextBox3.Text <> " " Then ThirdNum = 0
If TextBox1.Text <> " " Then FirstNum = 0
If TextBox2.Text <> " " Then SecondNum = 0
'Determine which operation based on the radio button
If RadioButton1.Checked = True Then
TextBox4.Text = (FirstNum + SecondNum) * ThirdNum
(other equation tested and works)
End If
If RadioButton2.Checked = True Then
TextBox4.Text = (FirstNum - SecondNum) Or
(SecondNum - ThirdNum) Or
(ThirdNum - FirstNum) Or
(FirstNum - ThirdNum)
End If
http://gyazo.com/4aaa2be43378047fb20cc32a5a1a72ac
http://gyazo.com/fe1aa8e2795069a0d5f06bd123607f06
So to clear somethings up If I fill Variable A with the number 4 and Variable B with the number 1 I get this error
http://gyazo.com/56edc0c677d1dde6688234c39010f450
But if I fill the third variable © with zero it calculates it no problem how do I fix this error?
PS: Sorry for formatting issues will fix if there is any issues