How would I optimize a tab in WinForms?

60 Views Asked by At

The tab has 19 ComboBoxes which each gets populated by roughly 500 items, WinForms causes quite a lot of lag when loading the tab is there any way I could optimize this, this only happens on the first load of the tab anyway to do this would be nice ( the actual populating of the combo boxes is quick enough it's only when loading the tab )

I've tried different ways to populate but it wasn't the problem, I tried loading the tab before the form even loads but that just pushes the delay there.

1

There are 1 best solutions below

0
TomTom On

Sure. Do not do the loading synchronously. Period.

Anything you do within an event handler blocks the UI. Minimum run the load on another thread, invoking in to fill the data. Better learn async and implement it in async handlers.

Btw., not a winform specific question - that is something for the whole windows UI (including WPF). Anything in an event handler blocks the windows events which are doing all the nice things like moving windows.