string Athlete_Year = "2019-20"; // 2019-20, ALL, 2018-20
string Athlete_Division = "I"; // I , II, III
string Athlete_Sport = "Women's Cross Country"; // "Men's Cross Country" , "Men's Track, Indoor" , "Men's Track, Outdoor" , "Women's Cross Country" , "Women's Track, Indoor" , "Women's Track, Outdoor"
string Number_Of_Results = "500 rows"; // 10, 25, 50, 500
string Athlete_Name = "Ashley Smith";
//--------------------------------------------------------------------------------------------------
private void BtnDivision1_Click(object sender, EventArgs e)
{
LblDivision.Text = "I";
}
//set for a button, i don't know how to use drop down options
I have a set of variables that work in my program. if i want to change the variables for example "Number_Of_Results" i need to manually do it within the code. im now learning how to use a form interface and was wondering how do i set one of these variables to one of the other options based on the form selections?
sorry I'm new to this.
For example i made a drop down box where you can select 10, 25, 50, and 500
once one of the options are selected how do i make the variable change to the selected amount.
BONUS: from there how do i make a Start button to run the code. i originally made the code for this program to run in a console app. is there a way to copy paste the source code from the console base one and embed it into a Start button?
You can perform these tasks from Events. Check out this site for more information on Events.
https://www.tutorialsteacher.com/csharp/csharp-event
Coming back to your questions, For Combo box use the following event.
You can subscribe to the SelectedValueChanged and SelectedIndexChanged events and change the variable values in the Event handler.
For start button click, use the following event.
https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.control.click?view=netcore-3.1
Use the button.click event on the start button to run your start code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.