BrandonMPSMI
Active member
- Joined
- Oct 8, 2008
- Messages
- 43
- Programming Experience
- Beginner
This is weird (forgive me I'm new to VB)
Here's my code
The weird thing is it never uses any of the If statements even though they are true! I'm stumped.
Edit----
The Textbox1 is just a test textbox to see if the string calcFunc is correct (it is correct too!)
Here's my code
VB.NET:
Private Sub Button_Percent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Percent.Click
Percent = Val(TxtDisplay.Text)
TextBox1.Text = calcFunc
If calcFunc = "divide" Then
'this divides by a percentage
result = (Total1) / Percent * 100
TxtDisplay.Text = result
TextBox1.Text = calcFunc & "1"
End If
If calcFunc = "multiply" Then
'this will find a certain percentage eg 10%
result = (Total1) * Percent / 100
TxtDisplay.Text = result
TextBox1.Text = calcFunc & "1"
End If
If calcFunc = "add" Then
result = (Total1) * Percent / 100
result = (Total1) + (result)
TxtDisplay.Text = result
TextBox1.Text = calcFunc & "1"
End If
If calcFunc = "subtract" Then
result = (Total1) * Percent / 100
result = (Total1) - (result)
TxtDisplay.Text = result
TextBox1.Text = calcFunc & "1"
End If
End Sub
Edit----
The Textbox1 is just a test textbox to see if the string calcFunc is correct (it is correct too!)