row validate fires also when binding

  • Thread starter Thread starter Tavo
  • Start date Start date
T

Tavo

Hi. I am binding a datagridview to a BindingList.
I put some actions to be performed after RowValidated Event is fired.

I have the problem that this event is also fired while binding for
every bounded row.

Is there anyway to avoid rowvalidated to occur while binding?

Moreover is there a simple way to know in the validated event if a row
had changed or not?

I know some workarounds (checking formatted value when validating,
using cell edit events, etc) but i search for cleaner code...

Thanks.

Gustavo.
 
Tavo said:
Hi. I am binding a datagridview to a BindingList.
I put some actions to be performed after RowValidated Event is fired.

I have the problem that this event is also fired while binding for
every bounded row.

Shocking. But did you try to assign the event after binding and not
before?
Do you know that you can use "-=" with events?

MH
 
Heya Tavo,

Not the mist ideal method, but you could add a boolean field to your class
and set it to true when you are binding; then wrap your binding with an if
block if the boolean is false then validate else don't :)

Brendon
 
Back
Top