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

Filling a list box from a table

Hi

VS2008. I have a table in an access database. How can I fill a list box with
a column from the table?

Thanks

Regards
Dec 31 '07 #1
3 978
John,

Just get the table in any way, if that is a datatable, then it is just
setting the datasource to the table, the displaymember to the columname (as
datable.Column.Columname or as string) and the same for the valuemember

To get the table you need OleDB.

It is so simple that there are probably no samples for this.

Cor

Dec 31 '07 #2
On Mon, 31 Dec 2007 11:06:16 +0100, "Cor Ligthert[MVP]"
<no************@planet.nlwrote:
>John,

Just get the table in any way, if that is a datatable, then it is just
setting the datasource to the table, the displaymember to the columname (as
datable.Column.Columname or as string) and the same for the valuemember

To get the table you need OleDB.

It is so simple that there are probably no samples for this.

Cor
If I can do a follow on from there.

If the table the data is coming from is a lookup table (say a unique
ID and a branch name), if I have branch name as the displaymember and
the unique id as the value member. How would I then go away saving
the value of the unique id to another table?

Don
Jan 1 '08 #3
myListBox.DataSource = MyTable
myListBox.DisplayMember = "BranchName"
myListBox.ValueMember = "MyIDName"

With a ; at the end in C#

TheOtherTable.Rows(TheRowRowNumber).Item("TheField ") =
myListBox.SelectedValue
or in C#
TheOtherTable[TheRowNumber]["TheField"] = myListBox.SelectedValue;

Cor

<dg******@hotmail.comschreef in bericht
news:mn********************************@4ax.com...
On Mon, 31 Dec 2007 11:06:16 +0100, "Cor Ligthert[MVP]"
<no************@planet.nlwrote:
>>John,

Just get the table in any way, if that is a datatable, then it is just
setting the datasource to the table, the displaymember to the columname
(as
datable.Column.Columname or as string) and the same for the valuemember

To get the table you need OleDB.

It is so simple that there are probably no samples for this.

Cor
If I can do a follow on from there.

If the table the data is coming from is a lookup table (say a unique
ID and a branch name), if I have branch name as the displaymember and
the unique id as the value member. How would I then go away saving
the value of the unique id to another table?

Don
Jan 1 '08 #4

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

Similar topics

2
by: Laphan | last post by:
Hi All I know the subject sounds strange, but please bear with me. Using ADO/ASP, I want to retrieve a list of pics from my db (which will be dynamic number of pics as a user will be uploading...
6
by: Brian | last post by:
Hello, Basically, I'm running a query on a form's activation, and I'd like to have the results of the query be placed into other fields on the same form automatically. Does anybody know how...
2
by: ramesh | last post by:
hi, I am using Com+ in my application. It will have InsertRecords,selectRecords,updateRecords function. In the Web Form i have Drop-down list. I want to select records from SQL and add it to this...
3
by: Russ | last post by:
I have a drop down list on a web page that I pre-fill onload from a SQL table using a SqlDataReader. The line of code that fills the drop down looks like this while(myReader.Read()) {...
3
by: crjunk | last post by:
I have a 3 table in my DataSet that I'm filling with data. After I've filled these 3 tables, I'm then trying to run a query that will fill a 4th table in the DataSet with data from the three...
11
by: Brian Henry | last post by:
Well here is the problem, I have a data set with about 9,000 to 20,000 people in it in the data table "people"... I am then reading it into a list view one at a time row by row... adding each...
6
by: fstenoughsnoopy | last post by:
I have a customer order database and I need to pull a customers information, ie first name, last name, address, city, state, zip, phone, etc, into the oder table. i don't know how to go about...
1
by: mlarsen1982 | last post by:
Hello, I have a quick question regarding filling a list box. Basically I need some assistance for a starting point. I have a form with 4 radio buttons for the user to select, then press next....
9
Vini171285
by: Vini171285 | last post by:
Hi, Actually i am filling a list box from database and depending on change in that list box ,the value corresponding to that selected index should come in the textbox,which should come from another...
1
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: 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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.