public static bool Login(string name) { bool value = false; try { dialog = new CredentialsDialog("InFlow Outlook Add-In"); //dialog.Persist = true; if (name != null) { dialog.AlwaysDisplay = true; // prevent an infinite loop } if (dialog.Show(name) == DialogResult.OK) { if (Authenticate(dialog.Name, dialog.Password)) { value = true; if (dialog.SaveChecked) { dialog.Confirm(true); } } else { try { dialog.Confirm(false); } catch (ApplicationException applicationException) { // exception handling ... } value = Login(dialog.Name); // need to find a way to display 'Logon unsuccessful' } } } catch (ApplicationException applicationException) { // exception handling ... } return(value); }