Reputation: 23
I am trying to create a program for a sports game online to list the potential players you can acquire from each team and their maximum stats that can be reached after leveling them up.
Long story short I am trying to use multiple combo boxes in MS Visual '12 (User selects team from one combo box, then one of the 5 ratings from in-game, and lastly the player from that team and rating). Once its all selected I would have a text box displaying their maximum stats. How would I be able to do this?
Upvotes: 2
Views: 1510
Reputation: 1360
There are quite a few ways one could accomplish this. If you have multiple contributors to there stats (for example, a batting average, and the speed they can run) you could assign number values to each option which might look something like this:
if (comboBoxRBIs.Text == 23){
RBI = 23; //Make a variable called RBI for the player(s) and assign it a value.
}
Then consider you asked how to display that, just use something similar to:
label1.Text = RBI; //This will display how many RBI's that player has.
You could then expand on this by using a rich text box (to have more text display easier in my opinion) or if you want it to display all their stats in one area, do something similar to:
// playerName. RBI, and speed are all variables you assign with the comboBoxes.
label1.Text = "Player" + playerName + EnvironmentNewLine() + "RBI's" + RBI +
EnvironmentNewLine() + "Player" + playerName + EnvironmentNewLine() + "Player Speed" +
speed; //EnvironmentNewLine() sets the text to the next line
I hope this helped, and if I did not answer you question well please let me know and ill try to be of more assistance :). Good luck with your program!
RE-REPLY:
Okay that's fairly simple try something like this:
if (comboBoxPlayer.Text == "Babe Ruth")
{
comboBoxRating.Text = "Rating";
}
//Then make the last comboBox change the text of the label do something like this:
//comboBox3 is whatever you want to call the last combobox
if (comboBox3.TextLength != 0){
label1.Text = "Your text or variables";
}
Upvotes: 1