Home > Mobile >  C# Back button on visual studio
C# Back button on visual studio

Time:11-18

I am creating a quiz for my As level coursework on visual studio 2019(c#). In this I will be creating a help button that will have information that the user may need if they are stuck. The button to access the help form will be avaliable through a menu strip bar loacted in the top corner of every form. In the help form there will be a menu strip bar with a back button. I would like to know how to code a back button to go back to the previous form eg Question 1-10 forms or the login form. I know how to code it if i wanted to back to a specific form but it is the fact it may need to back to any form as i dont know which form the user will have previously been on.

CodePudding user response:

Commonly, one would store the questions in a list or array. If you also store the index of the current question, then you could use that to return to the correct question.

CodePudding user response:

The button should navigate between different windows:

STEP 1 - add a new button on your current window.

STEP 2 - double click on that button to access cs file:

private void Button_Click(object sender, RoutedEventArgs e)
{    

}  

STEP 3 - create a new object window (to navigate to) and open that, then close current window

private void Button_Click(object sender, RoutedEventArgs e)
{ 
    NewWindow page2= new NewWindow();
    page2.Show();
    this.Close();
}

You should be able to move between different pages back and forth

  • Related