예제 #1
0
        private void BtnReturn_Click(object sender, EventArgs e)
        {
            //Sets closes FrmHighscores and opens FrmGame
            SaveHighScores();
            FrmGame FrmGame2 = new FrmGame(name);

            Hide();
            FrmGame2.ShowDialog();
        }
예제 #2
0
        private void BtnEnter_Click(object sender, EventArgs e)
        {
            playerName = TxtName.Text;

            if (Regex.IsMatch(playerName, @"^[a-zA-Z]+$"))//checks playerName for letters
            {
                            {
                                    //if playerName valid (only letters) 
                                    FrmGame FrmGame2 = new FrmGame(playerName);

                    Hide();
                    FrmGame2.ShowDialog();
                }
            }
            else
            {
                                //invalid playerName, clear txtName and focus on it to try again
                                MessageBox.Show("please enter a name using letters only!");

                TxtName.Clear();
                TxtName.Focus();
            }
        }