Joey

Joey

  • NA
  • 6
  • 2.3k

How to read in numbers from a text box?

Feb 27 2013 10:50 AM
Hi guys, I have a database with name, num1, num2, num3 and numbers listed underneath.

num.numDataTable numtable = num.GetData();
foreach (DataRow row in numtable.Rows) 
if (TextBox1.Text == System.Convert.ToString(row["num1"]))
{
Label1.Text = System.Convert.ToString(row["name"]) + ", You entered a correct number! ";
}

The user will enter a number in the textbox for example 5. If this number 5 matches to a name in row 'num1' then it will say correct number.

Now I want the user to be able to enter 3 numbers from each of the rows 'num1', 'num2' and 'num3.
for example: User will enter 5, 6, 9 into one textbox. I then need to somehow parse this into 3 seperate numbers and then check each against 'num1' 'num2 and 'num3 rows from database just like I did with the first number to check they all match.

I tried using the split method but no luck. Thanks in advance.

Answers (2)