Populate a listbox after completely loading a form

  • Thread starter Thread starter Yakimo
  • Start date Start date
Y

Yakimo

I have a very simple application, consisting of a form and a listbox on it.
I would like automatically to populate the listbox after the form is loaded
and displayed, not using a button.
But if I put my code in Load event, the form is not shown until after the
listbox is populated.
Because populating the listbox is not fast in my case, I also would like the
list items to be visible after I insert them one by one, not at the end when
the entire process is finished.

How can I do that?

Thanks,
Yakimo
 
Yakimo said:
I have a very simple application, consisting of a form and a listbox on it.
I would like automatically to populate the listbox after the form is loaded
and displayed, not using a button.
But if I put my code in Load event, the form is not shown until after the
listbox is populated.
Because populating the listbox is not fast in my case, I also would like the
list items to be visible after I insert them one by one, not at the end when
the entire process is finished.

How can I do that?

Use the Form.Activated event.
 
Yakimo said:
I have a very simple application, consisting of a form and a listbox on it.
I would like automatically to populate the listbox after the form is loaded
and displayed, not using a button.
But if I put my code in Load event, the form is not shown until after the
listbox is populated.
Because populating the listbox is not fast in my case, I also would like the
list items to be visible after I insert them one by one, not at the end when
the entire process is finished.

How can I do that?

You can solve the first problem by using a timer. Put the code that
populates the form in the Tick event handler. The first thing the code
should do is disable the timer, so that it does not fire more than once.

To solve the second problem, use a background thread. Needs careful coding
but there are code samples on the web.

Tim

IBM's take on web services and SOA:
http://www.itwriting.com/ibmwebservices.php
 
Back
Top