problem with modeless child dialog

  • Thread starter Thread starter AboutJAV
  • Start date Start date
A

AboutJAV

Hi,

I created a child dialog to tell the user that there is a loading of
data from the database. When the loading is done, the child dialog will
close. The child dialog contains a custom control and the child dialog
with the custom control show up fine if the dialog is called as a modal
state

dlgLoading.ShowDialog();

However, the process will stop unless the dialog is closed. I tried
using the modeless state


dlgLoading = new LoadingUI(); // in the class constructor

dlgLoading.Show(); // in another method

When the loading data is done, this is called

dlgLoading.Hide();


However the child dialog is not painted correctly. It is all black. I
can't see the custom control.

What call is missing. Any help is appreciated.

Thanks
 
My first guess would be that while loading your data, the process never
returns to handle its events, so your parent form won't get the chance
to properly redraw itself or its children.
If you use a loop to load your data you could try calling
Application.DoEvents() on each iteration. Depending on how fast your
loop runs, this might already be enough to make the application seem
responsive to the user.
Otherwise you might consider moving your loading functionality into its
own thread, so it won't lock up your form. This would of course require
some way to assure that your application doesn't try to work with data
that is not yet loaded.

Sincerely,
Kevin Wienhold
 
Back
Top