Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

show all items in list box on open of form in vb.net

Status
Not open for further replies.

punky

Programmer
Mar 21, 2001
29
US
on opening a form in vb.net, how do you show all items in a list box. What is the sql statement?
 
What do you mean by all items?
If you want to display all fields in a recordset, then you would be better to use a grid or listview.


Sweep
...if it works, you know the rest..
Always remember that Google is your friend

curse.gif
 
I want to display all records in a recordset. The recordset is named Cemetery and has two columns (cemeteryname and code).
 
According to your post, you're looking for the SQL statement...but you already have the recordset complete. If you're needing the code to add it to a listbox, then that raises a question. Do you want the user to click on one item and it highlight both the cemeteryname and code?

If the answer is yes, then the standard listbox will not work for you. You'll need to go out and find a 3rd party control or use a datagrid. The datagrid has row properties that you can add to with the data.

If your answer is no, then set the columns property to 2. Then just use the listbox1.additem method to add the items one at a time to the listbox. The order in which they will go in is left to right, top to bottom. This isn't the cleanest way to go, but it will semi-work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top