|
-
Oct 30th, 2008, 01:36 PM
#1
Thread Starter
Lively Member
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!!
-
Oct 30th, 2008, 01:45 PM
#2
Addicted Member
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
Last edited by redmo; Oct 30th, 2008 at 01:50 PM.
The universal aptitude for ineptitude makes any human accomplishment an incredible miracle -Col. John P. Stapp
Please rate the posts that have helped. Makes us feel all warm and fuzzy
-
Oct 30th, 2008, 01:53 PM
#3
Thread Starter
Lively Member
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?
-
Oct 30th, 2008, 02:16 PM
#4
Addicted Member
Re: Combo Box help
you don't give equals a value.
It should be given the answer to the sum
Redmo
The universal aptitude for ineptitude makes any human accomplishment an incredible miracle -Col. John P. Stapp
Please rate the posts that have helped. Makes us feel all warm and fuzzy
-
Oct 30th, 2008, 02:29 PM
#5
Thread Starter
Lively Member
Re: Combo Box help
Ooops my mistake!! it works now!! Thank you very much!!
-
Oct 30th, 2008, 02:32 PM
#6
Addicted Member
Re: Combo Box help
Tá fáilte romhat 
Redmo
The universal aptitude for ineptitude makes any human accomplishment an incredible miracle -Col. John P. Stapp
Please rate the posts that have helped. Makes us feel all warm and fuzzy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|