Hi, folks.
I have a form with many textboxes, some for strings and some for integers. I want to create a function that, when the user tries to save the data, tests the contents of the numeric textboxes to be sure to pass correct values to the DB. The function I made was the following, to test only one textbox:
What I want to do, if the textbox contains other than numbers is to set focus on this textbox and send a message to the user. My problem is that I don't know how to use the variable _FieldName contentes to focus it.
Can anybody help me?
Thanks.
I have a form with many textboxes, some for strings and some for integers. I want to create a function that, when the user tries to save the data, tests the contents of the numeric textboxes to be sure to pass correct values to the DB. The function I made was the following, to test only one textbox:
C#:
private bool TestAll(ref string _FieldName)
{
if (!int.TryParse(tb_Num.Text, out int Test))
{
_FieldName = "tb_Num";
return false;
}
return true;
}
Can anybody help me?
Thanks.
Last edited by a moderator: