Databount ErrorProvider

J

Jeppe Jespersen

I read the following - regarding the ErrorProvider control - in the MOC
Course Material for course 2373:

"You can set your own error messages manually, as shown in the following
example, or when working with bound data, you set the DataSource propertyof
the ErrorProvider to automatically pick error messages up from thedatabase."

So, basically I want the ErrorProvider to automatically pick up database
errors, but have so far had no luck. The MOC gives no example, so I pretty
much have to clue.

Any ideas?

/jdj
 
J

Jay B. Harlow [MVP - Outlook]

Jeppe,
If you bind a DataTable to a DataGrid, you can use the DataRow.RowError and
DataRow.SetColumnError methods to set errors for a specific row or a
specific column. The datagrid will then display an error icon w/tooltip on
that row (RowError) or cell (SetColumnError).

I have used both to set user errors, such as value required, normally I
handle the DataTable.ColumnChanging event to use the above DataRow methods.

I'm not sure what the book means by "from the database".

Hope this helps
Jay
 
J

Jay B. Harlow [MVP - Outlook]

Jeppe,
BTW: Post if you want a sample of what I mentioned in my other post.

Hope this helps
Jay
 
J

Jeppe Jespersen

Hi Jay,

I would like a sample, if you have one handy.
If you bind a DataTable to a DataGrid, you can use the DataRow.RowError
and
DataRow.SetColumnError methods to set errors for a specific row or a
specific column.

But... I don't see the big advantage of using the setError methods.
I mean, aren't you pretty much examining the entered values "manually"
when you use this approach? What exactly is it that the "databoundness"
of this approach gives you "for free"?

Also, what if i'm not using a datagrid, but just textboxes? Does that
render the datasource property of the errorProvider completely useless?

I sincerely hope I'm missing something.
....which has been known to be the case, other times :-D

Jeppe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top