Performance tip for databound UI


When loading large amounts of data into a dataset table with databound UI, things can get pretty slow. One reason is that each time a row is added to the table, the databinding components will perform some work and tell the databound controls that a new record was added. To improve performance, you can suspend the binding events while the data is being loaded. The BindingSource component has a RaiseListChangedEvents property for that purpose. Here’s an example how to use it:

    AddressBindingSource.RaiseListChangedEvents = False
    AddressTableAdapter.Fill(AdventureWorksDataSet.Address)
    AddressBindingSource.RaiseListChangedEvents = True
    AddressBindingSource.ResetBindings(False);


Another option is to disconnect the BindingSource component while the Fill is being executed by setting its DataSource property to Nothing and reconnect it after Fill has completed.

HTH

Antoine
Visual Studio Data Design-time


Comments (5)

  1. Ricky says:

    Is it in Visual Studio 2005 beta2 ?

  2. SD says:

    Hey Steve, I was looking for some clips of the crank call show, which i used to watch on public access and came across that you worked on it. any chance of posting or sendimnd me some clips? thanks.

  3. SmartClientData says:

    Wow, that’s a blast from the past. The Crank Call Show was way back in my high school days. In fact, most of the shows were in black & white as the budget was really tight just to remember how long ago that was :). Unfortunately I didn’t have the foresight to save any of the tapes. I don’t even remember if we recorded any of the live broadcasts as that was extra $5. If you do find any of the shows, please let me know. We had a lot of fun with early live cable TV. Anybody remember the Robyn Bird Show, the A Play, Tele-Psychic w/Morris Fonte? These were just a few of the shows I worked on with some great people.

    Steve