By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,903 Members | 1,439 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,903 IT Pros & Developers. It's quick & easy.

Populate a listbox after completely loading a form

P: n/a
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
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Yakimo wrote:
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.
Nov 16 '05 #2

P: n/a
"Yakimo" <ty******@fullof.spams> wrote in message
news:e%****************@TK2MSFTNGP09.phx.gbl...
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
Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.