473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Populate a listbox after completely loading a form

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
2 3729
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: James Goodman | last post by:
I have a listbox named sub1 on an asp page. I need to fill this list with values from a table. These are selected based upon the selection of a value/s in another listbox. It was suggested that I...
2
by: Wishing I was skiing mom | last post by:
Newbie to VB .NET. My solution contains an item maintenance screen, one of the fields on the screen is an item status, this field is defined as a listbox. The listbox item property contains a...
1
by: John M | last post by:
I have 1st list box from table Grain 2nd list box from related table Varieties, related by GrainID At the moment Grain listbox is on its own form and Variety listbox is on subform in Grain form....
2
by: Yakimo | last post by:
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...
1
by: Devin Wood | last post by:
Hi, I have a page with a ListBox on it, and It's also have a some buttons to populate the ListBox by using JavaScript. I have no problem with populate the listbox using JavaScript. But when the...
1
by: Spock | last post by:
Hi. I have a form with a listbox and a few label fields all bound to a dataset. When i navigate the listbox the labels change accordingly. so far everything works good. I made a button to...
5
by: Arpan | last post by:
In order to populate any server control with data dynamically, is it ALWAYS NECESSARY to either BIND the DataSource to that server control or call the DataBind method of that server control? For...
8
by: nirdeshonline | last post by:
Hi, I have added a simple listbox in windows form under c# 2.0. It contains a collection of approx 10 strings as list items. Now when i resize the form whole listbox flickers. Please tell me...
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
8
by: PeteOlcott | last post by:
http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_change_structure.html I would like to completely understand how GUI controls such as this one are constructed. In the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.