Adding Combo Boxes with numbers in their collection.

25 pts.
Tags:
ComboBox
Visual Basic
Visual Basic 2008
I have two combo boxes, each with a collection from 0 - 10. A number has been generated using the randomize() function - between 1 - 20 and is shown in a label.text. My problem involves the combo boxes not actually 'adding up' like numbers should. Maybe because they aren't actually number at all, I'm not sure. So for example, the random number equals to 10. You use the dropdown boxes to find the numbers that equal to 10. And so after that, when you click - I guess, an 'Enter' button, it doesn't equal. I've been using this code: If Combobox1.SelectedItem + Combobox2.SelectedItem = label3.text then msgbox("correct") end if Am I on the right track?

Software/Hardware used:
Microsoft Visual basic 2010 Express

Answer Wiki

Thanks. We'll let you know when a new response is added.

Try converting the strings to integers:

<pre><b>Convert.ToInt32</b>(ComboBox1.SelectedItem) + <b>Convert.ToInt32</b>(ComboBox2.SelectedItem)

</pre>

Thank you! -Vertify-

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following