I have a project where the user selects from 4 combo boxes, and I want to "Keep Score" based on their selections in those combo boxes

They pick the 1st item in the 1st cbo box, it adds 1, if they pick the second item, it adds 2 and so on - when they click "COMPUTE" button, the code using IF...THEN...ELSE or Case structure will compute the total "score," and display the result in a message box.

Anyone know where I can get a snippet of code that would closely resemple that ? I could figure the rest out...change the names etc. - I am a newbie to VB.NET, and wouldn't know where to start...

Thanks ! :cheesy:
Steve

firstly you need to set a variable to store the score temporarily. to do this type at the top of the forms code (above the load event):

dim compute as integer

then go down to the code for ur combo boxes and to each one add:

compute = compute + 1

then go to the code for your compute button and type into the code:

name of textbox that your showing the result in.text = compute

that should do the trick if it doesnt i'll try and think of something else.

cheers,
steve

each item in a combo box has an index:

index = 0 for first item
index = 1 for second item
index = 3 for third item
...etc

Then you can compute "SCORE" by adding the indexes of the combo boxes selected.

You can also increment SCORE whenever the combo box change, so the user does not have to do the extra step of clicking the button, plus you can show the SCORE everytime he makes a selection.

hope it helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.