Martijn
Martijn

Reputation: 24789

Why is databinding so slow?

I am using databinding in my winforms project, but setting the DataSource property takes a few moments:

eventBindingSource.DataSource = _event;

I've tried setting the SuspendBinding() and ResumeBinding() methods, but this didn't make the binding faster.

Do you have any ideas to speed up the data binding?

Also when I edit a control, it goes very slow.

I am using Winforms, C# and the Entity Framework and _event is a POCO class with about 20 properties.

Upvotes: 0

Views: 2257

Answers (2)

Fanda
Fanda

Reputation: 3786

Turn of all auto sizing of DataGridView first, then set DataSource property, and set up your auto sizing preferences back. This really boost the power of DataGridView.

Upvotes: 0

Steven P
Steven P

Reputation: 1996

I suggest you install a profiler (there are free ones) and find out exactly what's taking the time. It will prevent any guesswork and you'll learn a lot about what is going on under the covers.

  • Paid: ANTS and dotTradre
  • Free: Equatec and SciTech

VS 2010 comes with one too if you have a high enough edition (can't remember which).

All linked from from this answer

Upvotes: 1

Related Questions