c# - Controls doesn't show if heavy process -


i use c# in winform.

before heavy function, want show waiting form prevent user. form opens, controls in not drawn.

in following code, waitingform little form, textbox , progressbar

using (waitingform waitingform = new waintingform()) {   waitingform.show();   heavyfunction(); } 

i see 2 white rectangles, controls should appear. why happens ?

you can't show waiting form before heavy processing , expect ui remain responsive. thread you're clogging heavyfunction() same 1 responsible drawing forms, controls , maintaining ui. use backgroundworker or threadpool offload heavy processing thread.

edit: also, please consider ron beyer's input regarding async/await


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -