I do not know how to add a value to the text box. This code is:
Private Zero starecivilaComboBox_SelectedIndexChanged (Object Sender, EventArgs e) {if (starecivilaComboBox.SelectedIndex == 0) {MessageBox.Show ("This selection is not valid!"); } And if (starecivilaComboBox.SelectedIndex == 1) {int score = 4; } And if (Starcevilla Combo box selected index == 2) {int score = 1; } And if (Starcevilla Combo box selected index == 3) {int score = 3; } And if (Stresiva poem box selected index == 4) {int score = 2; }} I want to include the value of the score in a text box, so it will show me the score of each item selected from Cambodia. I tried with it: Private Zero ScoringTextboxTiped (Object Sender, EventAgds E) {ScoringTextbox. Text = score.tostring (); } But this is not recognized by it. The error is: Name 'score' does not exist in this context
How can you do this work?
You have the score index-bound handler outside the variable combobbox you selected it in the handler And it is being used only in the method, not in the whole class (not in the entire form in your case). Public class Form1 {int score = 0; // somewhere in the code score = 1; // There is no need to specify 'int' here - you will create a local variable with the same name}} I recommend you because the question is simple.
No comments:
Post a Comment