473,320 Members | 1,916 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,320 software developers and data experts.

Fill Listbox

I would like to fill a listbox with a 2 column valuelist and hide the value
in the first column as available in VBA. I have tried .items.add and
item.addrange but cannot seem to get the desired result. I am using the form
Load event to fill the listbox.
Regards
Feb 4 '07 #1
5 1715
"Terry" <ne*******@whiteHYPHENlightDOTme.ukschrieb:
>I would like to fill a listbox with a 2 column valuelist and hide the value
in the first column as available in VBA. I have tried .items.add and
item.addrange but cannot seem to get the desired result. I am using the
form Load event to fill the listbox.
Add the items to a "collection" ('DataTable', for example), assign it to the
control's 'DataSource' property and set its 'DisplayMember' and
'ValueMember' properties according to your needs.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Feb 4 '07 #2
Its not very often I agree with Herfried, but I do in this situation.

OMG! I am slipping! Help!!!!!!!!!!!!!!!!!!!!!!

--
Newbie Coder
(It's just a name)
Feb 5 '07 #3
Terry,

For this you have to fill class objects to the itemlist from a listbox.

You have to cast those when you need them. In fact you can use endless
columns.

(I normally give always the samples of datatables and than comes Herfried
with this class/object answer, I was supprised that he gave now my standard
answer).

Cor

"Terry" <ne*******@whiteHYPHENlightDOTme.ukschreef in bericht
news:%2****************@TK2MSFTNGP04.phx.gbl...
>I would like to fill a listbox with a 2 column valuelist and hide the value
in the first column as available in VBA. I have tried .items.add and
item.addrange but cannot seem to get the desired result. I am using the
form Load event to fill the listbox.
Regards

Feb 5 '07 #4
On Feb 5, 6:22 am, "Terry" <news-g...@whiteHYPHENlightDOTme.ukwrote:
I would like to fill a listbox with a 2 column valuelist and hide the value
in the first column as available in VBA. I have tried .items.add and
item.addrange but cannot seem to get the desired result. I am using the form
Load event to fill the listbox.
Regards
Me.myList.Items.Add(New ListItem("My_Display_Text",
"My_Hidden_Value"))

The Grand Master

Feb 5 '07 #5
Thanks for all the help.

I have decided to use a small SQL table which will allow me to easily add
new rows without having to re-code. I had needed to create the database for
this project so have taken this opportunity to learn something about
SQL2005.

Regards
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:ew**************@TK2MSFTNGP03.phx.gbl...
Terry,

For this you have to fill class objects to the itemlist from a listbox.

You have to cast those when you need them. In fact you can use endless
columns.

(I normally give always the samples of datatables and than comes Herfried
with this class/object answer, I was supprised that he gave now my
standard answer).

Cor

"Terry" <ne*******@whiteHYPHENlightDOTme.ukschreef in bericht
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>I would like to fill a listbox with a 2 column valuelist and hide the
value in the first column as available in VBA. I have tried .items.add and
item.addrange but cannot seem to get the desired result. I am using the
form Load event to fill the listbox.
Regards


Feb 6 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Harlin Seritt | last post by:
I am trying the following: Listbox(parent).pack(fill=BOTH, expand=YES) I notice that the listbox will fill on the X axis but will not on the Y axis unlike other widgets. Is there any way to...
9
by: Megan | last post by:
Hi- I'm creating a database of music bands with their cds and songs. I'm trying to program an SQL statement so that I can enter a string of text in a textbox, press the 'Enter' key, and have...
3
by: ali poursadri | last post by:
Hi, I want to fill my list box from a dataset in c#. I use adapter and fill command and bind it to a listbox, but it is very slow for large data about 500000 records. How can I view this list...
3
by: Hrvoje Voda | last post by:
How to Fill a listbox with data from database? Hrcko
0
by: Abra | last post by:
Is it possible to fill a ADO.NET dataset incrementally ? (I mean to call the DataAdapter Fill() method several times, as I did not found a Add() method) I would like to call in a background thread...
6
by: William Sullivan | last post by:
I want to fill a cell in a table with a control. Lets say the control is a listbox--something that you'd think would easily fill a cell, which would be a good thing. So I create the table and...
3
by: Rich | last post by:
Hello, I am just starting out with VB.net. I need to fill a listbox with data from an MS Access mdb file. What I tried was to create/add an ole connection object, then added an ole adapter...
1
by: Steve Richter | last post by:
I have a form. In the Form is a MenuStrip and a FlowLayoutPanel. In the FlowLayoutPanel is a ListBox. The FlowLayoutPanel is set to DockStyle.Fill. The ListBox is set to AnchorStyles.Left |...
1
by: Peter van der Zee | last post by:
L.S., I'm want to fill a Listbox with class Array "records" based on certain criteria. The idea is to be able to select one "record" at the time, modify the data, and display this "changed"...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
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

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.