private bool CheckInput() { if (string.IsNullOrEmpty(TxtUserName.Text.Trim()) || string.IsNullOrEmpty(TxtPassword.Text.Trim()) || string.CompareOrdinal(TxtUserName.ToString(), TxtUserName.Text.Trim()) == 0 || string.CompareOrdinal(TxtPassword.ToString(), TxtPassword.Text.Trim()) == 0) { LblErrorMessage.Content = "User name or password error."; return(false); } return(true); }