Postalcode = Convert.ToInt32(txtcity.Text);
Mobileno = Convert.ToInt32(txmobileno.Text);
Phoneno = Convert.ToInt32(txtphoneno.Text);
I am getting this error please any one help
Postalcode = Convert.ToInt32(txtcity.Text);
Mobileno = Convert.ToInt32(txmobileno.Text);
Phoneno = Convert.ToInt32(txtphoneno.Text);
I am getting this error please any one help
Are you sure your txtcity contains only numbers... You are trying to convert txtcity into numeric and store in postalcode...
Further if you want to check whether the text parsed is number use Int32.TryParse() method
The TryParse method will convert your string to int or will return false if not possible...
http://msdn.microsoft.com/en-us/library/system.int32.tryparse.aspx
An example is available here http://msdn.microsoft.com/en-us/library/f02979c7.aspx#Y1170
Most likely your textbox is returning non-numeric values causing Convert.ToInt32 to fail. You may either use string variables PostalCode, Mobileno and Phoneno fields (which I recommend because these fields generally tend to contain alphanumeric characters like +91 or 123-123 or FA1203)
However, if you are too keen to use Integer only, then use Int32.TryParse so as to avoid specified run-time error.