Ali Ashiq

Ali Ashiq

  • NA
  • 61
  • 32.4k

Validate Textboxes And I Have Value In Double Data Type

Feb 17 2014 2:57 AM
I have a two text boxes and i want to take amount and person from user and divide amount/person and convert result into double
here is my code but it will give me error, Here is my code and below is the erro code


protected void btnSearch_Click(object sender, EventArgs e) { if((txtAmount.Text == "") || (txtPerson.Text == "")) { Response.Write("please enter amount"); }  else { double amount = int.Parse(txtAmount.Text); double persons = int.Parse(txtPerson.Text); double result = amount / persons; d.Price = Convert.ToInt32(result); d.Select(d); Display(); }




Line 39:             else Line 40:             { Line 41:                 double amount = int.Parse(txtAmount.Text); Line 42:                 double persons = int.Parse(txtPerson.Text); Line 43:                 double result = amount / persons;

Answers (3)