Share via


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