private void loginButton_Click(object sender, RoutedEventArgs e) { // This is what jeff helped me understand with saving outside of the scope string enteredPIN = pinTextBox.Text; int userenteredPIN = Int32.Parse(enteredPIN); // This compares the code send and the code entered. if (userRandom == userenteredPIN) {//This creates a new instance of the object MainWindow window = new MainWindow(); this.Close(); window.Show(); } //This is part of my if/else statement obviously. It does this if the password wasn't correct. else { MessageBox.Show("Incorrect, Try Again."); } }
private void button_Response_Click(object sender, RoutedEventArgs e) { string code = textBoxResponse.Text; if (code != randomNumber) { MessageBox.Show("This is not a valid code please try again"); } else { MainWindow newWindow = new MainWindow(); newWindow.Show(); Close(); } }