473,326 Members | 2,102 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,326 software developers and data experts.

Populate listbox from another form

I want to fill a listbox that is on another form. I'm not sure how to declare it so the main form can see it. Help
Aug 18 '07 #1
1 1867
pureenhanoi
175 100+
I want to fill a listbox that is on another form. I'm not sure how to declare it so the main form can see it. Help
From the main form, use theSecondForm.List1.AddItem "the item text". But this method maybe not be Object Oriented Programming.
If you are using a database and recordset, try this aproach:
Expand|Select|Wrap|Line Numbers
  1. 'on the main form
  2. theSecondForm.FillListBox rs
  3. 'on the second Form
  4. Public Sub FillListBox(ByVal rs As Recordset)
  5. While Not rs.Eof
  6.   List1.AddItem rs!fieldName
  7.   rs.MoveNext
  8. Wend
  9. End Sub
Aug 20 '07 #2

Sign in to post your reply or Sign up for a free account.

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....
4
by: carl.barrett | last post by:
Hi, I have a list box that displays 2 columns. Behind it sits a query with five columns. These are Column1 (DOB), column2 (a concatenated string of Surname Forname, Title), Column3 (Surname),...
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...
3
by: Chris Kettenbach | last post by:
Hello all, Quick question. I have a listbox that is populated by items from a database. When the user select something from the list, I want to populate another listbox based on the selection in...
5
by: Dave | last post by:
Hi All, I have a windows form that contains 2 listboxes and 2 buttons. The listbox on the right is populated by a database routine (This is the easy part). The listbox on the left is populated...
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...
3
by: zuchowra | last post by:
Hello everyone. Im running Access 2007. The form i created logs a persons ID badge number and personal information however, i want to make a section that lists their skills. So I will add a button...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.