Need simple code for VB.NET

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2004
Posts: 1
Reputation: ironwood9 is an unknown quantity at this point 
Solved Threads: 0
ironwood9 ironwood9 is offline Offline
Newbie Poster

Need simple code for VB.NET

 
0
  #1
Oct 18th, 2004
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1
Reputation: =Delta= is an unknown quantity at this point 
Solved Threads: 0
=Delta= =Delta= is offline Offline
Newbie Poster

Re: Need simple code for VB.NET

 
0
  #2
Oct 9th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 85
Reputation: williamrojas78 is an unknown quantity at this point 
Solved Threads: 4
williamrojas78's Avatar
williamrojas78 williamrojas78 is offline Offline
Junior Poster in Training

Re: Need simple code for VB.NET

 
0
  #3
Oct 9th, 2007
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 5395 | Replies: 2
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC