By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,030 Members | 2,277 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,030 IT Pros & Developers. It's quick & easy.

DataGridView.SelectionChanged event fires twice

P: n/a
Hi Guys,

Can anyone tell me why the DataGridView.SelectionChanged event fires
twice when I databind to it.

If I do the following, the first row is selected automatically, but the
changed event fires twice:

List<Trailertrailers = Trailer.SelectAll();

trailerBindingSource.DataSource = trailers;

This is causing a problem because I hide various buttons based on which
row is selected and the multiple event invocation is causing screen
flicker as it executes multiple times

Can anyone help with this?

Many thanks

Simon
Mar 20 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mar 20, 7:09 am, Simon Harvey <notha...@hotmail.comwrote:
Hi Guys,

Can anyone tell me why the DataGridView.SelectionChanged event fires
twice when I databind to it.

If I do the following, the first row is selected automatically, but the
changed event fires twice:

List<Trailertrailers = Trailer.SelectAll();

trailerBindingSource.DataSource = trailers;

This is causing a problem because I hide various buttons based on which
row is selected and the multiple event invocation is causing screen
flicker as it executes multiple times

Can anyone help with this?

Many thanks

Simon
I've seen this before, and I don't know that you can prevent multiple
firings. What is selected each time it fires? Have you looked at
disabling the screen refresh while you bind?

Mar 20 '07 #2

P: n/a
Hi there,

Thanks for your reply.

When you say disable screen refresh when databinding occurs, what do you
mean?

Also, which events would it be safe to do this in?

Thanks again for your help

Simon
Mar 20 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.