-
Combo Box help
Hey,
I have two textboxes, basically its like a simple calculator
I have + in the combo box but I can't work out how to make this work.
Dim value1, value2, equals As Integer
value1 = tbValue1.Text
value2 = tbValue2.Text
If cbOperator.SelectedItem = "+" Then
lblEquals.Text = value1 + value2
lblEquals.Text = "= " & equals
End If
What am I doing wrong? Thanks!!:thumb:
-
Re: Combo Box help
change to cbOperator.SelectedItem.tostring = "+"
ToString returns a string value which will give you your true or false condition..
using cbOperator.SelectedItem on its own, returns 2 values, {String}, +. A handy hint for testing strings, would be to set up something like
dim mystring as String = cbOperator.SelectedItem to see the values been passed.
Hope all this helps
Redmo
-
Re: Combo Box help
Hey,
I did this but its just adding upto 0
Dim value1, value2, equals As Integer
value1 = tbValue1.Text
value2 = tbValue2.Text
If cbOperator.Text.ToString = "+" Then
lblEquals.Text = value1 + value2
lblEquals.Text = "= " & equals
End If
Any other ideas?
-
Re: Combo Box help
you don't give equals a value.
It should be given the answer to the sum
Redmo
-
Re: Combo Box help
Ooops my mistake!! it works now!! Thank you very much!!
-
Re: Combo Box help
Tá fáilte romhat ;)
Redmo