Click here to Skip to main content
15,559,819 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using this code.
int accno = System.Convert.ToInt32(mtbduedate.Text);
and give me the following error.


Input string was not in a correct format.


plz,plz, AnyOne Can Helpme
Posted
Comments
Mendor81 3-Dec-12 4:21am    
What is mtbduedate? a textbox or what kind of object?
Zain -Ul- Arifeen 3-Dec-12 4:45am    
textbox for the date

The exception message is clear, the Text property of the mtbduedate is a string that cannot be converted to an Int32 (because it contains invalid characters). You may handle such exception or (if you don't like to handle exceptions) use the Int32.TryParse method. In any case you have to deal with incorrect formatted input.
 
Share this answer
 
int accno = int.Parse(mtbduedate.Text);
 
Share this answer
 
Comments
Zain -Ul- Arifeen 3-Dec-12 4:46am    
give the same types of Error
Hi dear,

Check this solution.

int a = Convert.ToInt32(textBox1.Text);


if you like this solution plz vate.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900