How to Compare Two Textbox Values in C#

  1. if (txtpassword.Text.Trim() == txt_CnfmPWD.Text.Trim())  
  2. {  
  3.     // MessageBox.Show("same");  
  4. else {  
  5.     MessageBox.Show("Confirm password is not matched with password..?");  
  6.     return;  
  7. }