944,126 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 5815
  • VB.NET RSS
Oct 18th, 2004
0

Need simple code for VB.NET

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ironwood9 is offline Offline
1 posts
since Oct 2004
Oct 9th, 2007
0

Re: Need simple code for VB.NET

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
=Delta= is offline Offline
1 posts
since Oct 2007
Oct 9th, 2007
0

Re: Need simple code for VB.NET

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.
Reputation Points: 23
Solved Threads: 10
Junior Poster
williamrojas78 is offline Offline
111 posts
since Jun 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Dreamweaver templates in Visual Studio 2005
Next Thread in VB.NET Forum Timeline: how to Install vb.net window application on client system with database





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC