How to prevent UI from freezing during lengthy process?

后端 未结 4 1406
慢半拍i
慢半拍i 2021-01-15 06:27

I need to write a VB.Net 2008 applet to go through all the fixed-drives looking for some files. If I put the code in ButtonClick(), the UI freezes until the code is done:

4条回答
  •  时光取名叫无心
    2021-01-15 06:58

    Put the process into a separate thread.... ...using the BackgroundWorker component.

    Disable UI components that should not be usable while the process workd.

    Finished - the UI will still be responsive.

提交回复
热议问题