2

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?

1
  • Please post the code you are stuck with / specific question regarding the code itself. Commented Mar 31, 2013 at 22:07

1 Answer 1

1

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";
}
Sign up to request clarification or add additional context in comments.

4 Comments

Some what helpful. But what I need help is with the Combo Boxes. Example is those Country<State<City drop down boxes. I want to make something similar to that so that its Team<RatingOfPlayers<Players. In other words binding combo boxes so that whatever you select in the first box changes the values for the next combo box. Then once the final combo box has an item selected values are shown for that player in textboxes. I have this feeling I am asking for too much but let me know so I can find another way to do this :).
Okay thats fairly simple try something like this: 'code' if (comboBoxPlayer.Text == "Babe Ruth"){ comboBoxRating.Text = "Rating"; } //Then to make the last comboBox change the text of the label do something like this: //This comboBox is whatever you want to call the last combobox if (comboBox3.TextLength != 0){ label1.Text = // playerName. RBI, and speed are all variables you assign with the comboBoxes. label1.Text = "The text or variables you want"; {
Thank you very much Steven. Your answer gave me a better understanding on what I need to code. :)
Good, if you have any other questions feel free to ask, this site has a very good community as i'm sure you know or will soon learn :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.