I have a TextBoxD1.Text and I want to convert it to an int to store it in a database.
TextBoxD1.Text
int
How can I do this?
You can convert a string to int in C# using:
Functions of convert class i.e. Convert.ToInt16(), Convert.ToInt32(), Convert.ToInt64() or by using Parse and TryParse Functions. Examples are given here.
Convert.ToInt16()
Convert.ToInt32()
Convert.ToInt64()
Parse
TryParse