Hakan
Hakan

Reputation: 141

Validation against to database

I have several textboxes and users are entering same data in one of these fields. I have another table which is store machine_no. I would like to restrict user for possible wrong entries. Example if there is no machine_no #4 on table, user will be warn with message box.

Machine_no      Value1    In first day
1               500
2               400
3               600

Machine_no      Value1    second day
1               8678
2               45645
3               54645

Thanks in advance

Upvotes: 0

Views: 112

Answers (2)

Mario
Mario

Reputation: 440

You could use a NumericUpDown control to let the user enter only integers and validate against a generic List of integers or an array of integers (you can load the list with the existing machine numbers on your data base table), and finally you can use ErrorProvider control to show a warning to the user if enters a not valid number.

Upvotes: 0

Joe Stefanelli
Joe Stefanelli

Reputation: 135938

If you really want to restrict the available choices, I'd replace the free form textbox with a dropdown list of choices populated from your table.

Upvotes: 1

Related Questions