private void btnOK_Click(object sender, EventArgs e) { string errorMessage = null; if (Hostinfo.ValidatePassword(_sNewPassword, _sConfirmPassword, out errorMessage)) { uint result = (uint)LUGAPI.WinError.ERROR_SUCCESS; try { result = LUGAPI.NetChangePassword( _sHostName, _sUserName, _sNewPassword); } catch (Exception) { result = (uint)LUGAPI.WinError.ERROR_EXCEPTION_IN_SERVICE; } if (result == (uint)LUGAPI.WinError.ERROR_SUCCESS) { this.DialogResult = DialogResult.OK; Close(); return; } errorMessage = "Win32 Error: "; errorMessage += Convert.ToString(Enum.Parse(typeof(LUGAPI.WinError), result.ToString())); } Logger.ShowUserError(errorMessage); }