I am new to coding in C#. Currently I am encountering the problem of populating a textBox depending on the amount of times button1 is clicked. I have been able to populate option one but I am not sure how to get the second option after the second click and so fourth. How would I be able to do that? Also, Would I need to add a loop to start over after the fourth click?
Code
protected void Button1_Click(object sender, EventArgs e)
{
MyTextBox.Text = "Fruits"; //1st click
MyTextBox.Text = "Vegtables"; //2nd click
MyTextBox.Text = "Grains"; //3rd click
MyTextBox.Text = "Poultry"; //4th click
}
1 Answer