private void UserRegexBox_Leave(object sender, EventArgs e)
 {
     try {
         Regex regex = new Regex(@UserRegexBox.Text);
     } catch (Exception ex) {
         MessageBox.Show("The Regex you provided seems to have generated an error." + Environment.NewLine + "Exception Message : " + ex.Message, "Invalid Regex", MessageBoxButtons.OK, MessageBoxIcon.Error);
         UserRegexBox.Text = "";
         UserRegexBox.Focus();
     }
 }
 private void UserRegexBox_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         try {
             Regex regex = new Regex(@UserRegexBox.Text);
         } catch (Exception ex) {
             MessageBox.Show("The Regex you provided seems to have generated an error." + Environment.NewLine + "Exception Message : " + ex.Message, "Invalid Regex", MessageBoxButtons.OK, MessageBoxIcon.Error);
             UserRegexBox.Text = "";
             UserRegexBox.Focus();
         }
         if (UserRegexBox.Text != "")
         {
             RegexFinal = UserRegexBox.Text;
             NameFormatAdvanced NameSpecifierAdvanced = new NameFormatAdvanced(FileTypeForPassing);
             NameSpecifierAdvanced.ShowDialog();
             NameSpecifierAdvanced.Close();
             EnteredUserNameFormat = NameSpecifierAdvanced.FinalUserNameFormat;
             Close();
         }
     }
 }