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?
If you're looking for the long way, just create your one method:
static int convertToInt(string a)
{
int x = 0;
Char[] charArray = a.ToCharArray();
int j = charArray.Length;
for (int i = 0; i < charArray.Length; i++)
{
j--;
int s = (int)Math.Pow(10, j);
x += ((int)Char.GetNumericValue(charArray[i]) * s);
}
return x;
}