AfterLoad event?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a combobox that is populated with a pretty long list. I'd like to
reduce the form's load time by populating it on another thread after the form
is completely loaded and displayed. Any advice? What I need, I think, is
and AfterLoad event, but there isn't one.

Thanks,
 
If you fire off the thread in the load event, the form will still load
without the combobox being populated. As the worker thread is processing
the main thread will continue to load up the form. Why won't this work?

Chris
 
Aside from LOOKING ugly (the form slowly loads as the combo is being
populated), it also prevents the user from using the form and its other
controls while the slow combo population continues. Perhaps I am
implementing the thread incorrectly, but doing it this way seems to ensure
that the Load event doesn't complete until the combo population thread
(spawned in the Load event) finishes.
 
hmmm... I must admit I haven't done it myself. Try to sleep the thread for
10 seconds (Thread.Sleep(10000)) before starting to process. Does the
form finish loading then?

Are you the same guy that was trying to do this w/ a splash screen but the
form will still delay while it was binding?

Chris
 
pmcguire said:
I have a combobox that is populated with a pretty long list. I'd like to
reduce the form's load time by populating it on another thread after the form
is completely loaded and displayed. Any advice? What I need, I think, is
and AfterLoad event, but there isn't one.

Instead of a second thread, how about adding a Timer, and starting it off
in your load event. If that Timer routine only loads 50-100 items each Tick,
then it would not adversely effect whatever else the user wants to do.

Unless your list has tens of thousands of items, the user would have to be
pretty quick to click on the combo box before it gets finished. (assuming
a real small timer interval...)

LFS
 
Pat,

I assume that you use a dataset or another collection.
Can you try to set the binding (datasource) after that you have filled that
collection?

And not in your designer.

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top