T
Tom
I have seen articles saying that validating the data a
user enters into a datagrid is difficult, because it is
not the datagrid itself that does the validation, but
rather textboxes that are in the cells. The article then
says that it is best to validate the datatable behind the
grid using row or column changing events.
I have a few questions about this.
If I am to use row or column data changing events on the
underlying table, is there a way I can keep those event
routines from being called when my program changes the
data in the table while they are still called when the
user modifies the data via the datagrid?
I find that if I bind to the datagrid a table that is in a
dataset that was loaded from a database via a data adapter
and one of the fields is numeric, that the datagrid
magically won't allow non-numeric entries in that column.
This is exactly what I want. How can I get this
functionality for a datatable I have not loaded from a
database?
Is there someway I can have the datagrid use my own
validatedTextBox (which inherits from textBox) for the
data entry in the cells that would then allow me to do the
validation I want.
By-the-way, all I need to do is make sure that valid
numbers have been entered in a cell. Any other way to do
this in a simple fashion would be welcome.
Thanks
user enters into a datagrid is difficult, because it is
not the datagrid itself that does the validation, but
rather textboxes that are in the cells. The article then
says that it is best to validate the datatable behind the
grid using row or column changing events.
I have a few questions about this.
If I am to use row or column data changing events on the
underlying table, is there a way I can keep those event
routines from being called when my program changes the
data in the table while they are still called when the
user modifies the data via the datagrid?
I find that if I bind to the datagrid a table that is in a
dataset that was loaded from a database via a data adapter
and one of the fields is numeric, that the datagrid
magically won't allow non-numeric entries in that column.
This is exactly what I want. How can I get this
functionality for a datatable I have not loaded from a
database?
Is there someway I can have the datagrid use my own
validatedTextBox (which inherits from textBox) for the
data entry in the cells that would then allow me to do the
validation I want.
By-the-way, all I need to do is make sure that valid
numbers have been entered in a cell. Any other way to do
this in a simple fashion would be welcome.
Thanks