row validate fires also when binding

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.
 
M

Marius Horak

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
 
B

Brendon Bezuidenhout

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
 

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