Newbie needs help with datagrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a datagrid control that allows the user to enter new values. The
datagrid is bound to a predefined dataset. If the user enters a value that is
already in the datagrid the following system generated message is displayed:

Error when committing the row to the original data store
-----------------------------------------------------------------
Column <column name> is constrained to be unique. Value <whatever> is
already present. Do you want to correct the value?
--------------------------------------------------
Yes No

I want to have a custom event handler such that if a duplicate value is
found to already exist that rather than display the above message the
addition is automatically aborted and the row where the existing value
resides is selected.

It seems from searching the forums that this should be something that can be
done with the CurrencyManager but I cannot seem to find an example of how to
use the CurrencyManager in VB.Net.

If there is a better way other than the CurrencyManager please let me know.
Any help much appreciated!
 
RBell,

There is not so much testing done automatic in the DataGrid, that this is
done, is probably that there is no other way.

The currencymanager will help you definitly not with this, at the moment
that you are inserting is this in fact pointing to the last row that is or
should be in a datatable.

This action is probably fired in a rowchange or endcurrentedit situation and
it violates the constraint about the primary key, but I don't know how to
intercept that event. (And am not curious enough about it to search for it).

Cor
 
Thanks for taking the time to reply. I can appreciate that you are not
curious enough to look into my problem. I however need to find a way to
handle this. Occasionally when the user the answers No to message I mentioned
it crashes the program.

Anyone have any insight into this??
 
Back
Top