I have a TextBoxD1.Text
and I want to convert it to an int
to store it in a database.
How can I do this?
cintnetstringtype conversion
I have a TextBoxD1.Text
and I want to convert it to an int
to store it in a database.
How can I do this?
Best Answer
Try this:
or better yet:
Also, since
Int32.TryParse
returns abool
you can use its return value to make decisions about the results of the parsing attempt:If you are curious, the difference between
Parse
andTryParse
is best summed up like this: