Visual Basic Nightmare: Need Yes/No ComboBox Help Please (Have a deadline)

By smile4bonita ·
I have a deadline today and have been working on this for a LONG time, please help....

I have created a simple form for a brief survey. In this survey the user is asked 3 Yes/No questions in addition to 8 others where they input numbers for answers. At the end of the form the user presses a button to calculate their totals. (It won't calculate.)

I have it almost right but when I debug, it does not calculate. (I get a error:
Conversion from "Yes" to type 'double' is not valid) and than it highlights my combobox code in yellow

'Convert combo box data to variables
typicallyPurchasedFoodAndBeverages = typicallyPurchasedFoodAndBeveragesCombobox.Text
typicallyPurchasedTShirt = typicallyPurchasedTShirtCombobox.Text
typicallyPurchasedCDAtHeadlinerConcertsOrMusicals = typicallyPurchasedCDAtHeadlinerConcertsOrMusicalsCombobox.Text

'Calculate the total cost of T-shirts
If typicallyPurchasedTShirt = Yes Then
totalCostOfTShirts = totalNumberOfHeadlinerConcertsAndMusicalsAndSportsGamesAttended * 20
totalCostOfTShirts = 0
End If

'Calculate totalCostOfCDs
If typicallyPurchasedCDAtHeadlinerConcertsOrMusicals = Yes Then
totalCostOfCDs = totalNumberOfHeadlinerConcertsAndMusicalsAttended * 15
totalCostOfCDs = 0
End If

If typicallyPurchasedFoodAndBeverages = Yes Then
totalCostOfFoodAndBeverages = totalNumberOfEventsAttended * 6
totalCostOfFoodAndBeverages = 0
End If
Example of Questions:
How many times have you attended a play at a local Community College? <<user inputs the number>>

Do you typically purchase a T-shirt when you attend a concert, musical or sports game? <<user inputs Yes or No from a ComboBox>>
if they answer yes than the number of events they have attended that sell T-shirts is multiplied by the cost of T-shirts to be added to the calculation

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -


by scott_heath In reply to Visual Basic Nightmare: N ...

Whch version of VB are you using?

In any case the line:

If typicallyPurchasedTShirt = Yes Then...

Should be:

If typicallyPurchasedTShirt = "Yes" Then...

Since the contents of the {object}.text property is a string.

Collapse -

Only a wild guess because of the lack of type declarations

by Tony Hopkinson In reply to Visual Basic Nightmare: N ...

but I'd say one of your typicallypurchased.... variables is a double as opposed to a string.

Collapse -


by mazvarirap In reply to Visual Basic Nightmare: N ...

Why not sustitute the combobox with just a pop up screen to make it easy ?

Related Discussions

Related Forums