Datagrid cell's Numeric Validation in c# -
I want to validate a separate cell in the datagram. If I want only numbers in a particular cell in the datagram, how can I do it? For example:
im using Datagrid View. I want to validate this phone number area with 3 columns, datagrid ID, name, phone number. If a user enters some other value from a number then I want to give an error message.
This can be an easy task as it is very new to C #. Please help me with this problem.
Thank you all
Do you have a public boot valid phone (string phone Number) method? If so, drag an error provider control into your form, if so, you can call that method in the text_changed event of the phone number field. If this happens - (
if (valid phone (phone number) == incorrect) {errorProvider.SetError (phone number text box, "please call a valid phone Enter the number ");} If (valid phone (phone number) == true) {errorProvider.SetError (phone number number," ");}
You can also call it on validity event I believe that this allows the user to leave the field, this is a better way if it is a web app desk For top, use the text_changed event.
If all the form fields are related to an object, then you can also add errors through data-packing, but I do not have enough detail for clarification on this I applied it, but the object and verification was written for me, I bowed it over the form, it really works, an error projector and my receipt Drags the database for each object, then set the data source of each and every field in the object. The error information is automatically in the Form_load event with a line of code:
Binding object. Datasource = Inserted Object;
Comments
Post a Comment