all groups > vb.net > december 2007 >
You're in the

vb.net

group:

Filling a list box from a table


Filling a list box from a table John
12/31/2007 3:48:26 AM
vb.net:
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

Re: Filling a list box from a table Cor Ligthert[MVP]
12/31/2007 11:06:16 AM
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
Re: Filling a list box from a table dgcarter@hotmail.com
1/1/2008 4:50:42 PM
On Mon, 31 Dec 2007 11:06:16 +0100, "Cor Ligthert[MVP]"
[quoted text, click to view]
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?

Re: Filling a list box from a table Cor Ligthert[MVP]
1/1/2008 6:02:16 PM
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

<dgcarter@hotmail.com> schreef in bericht
news:mnrkn351blqjlsci3evhksep8siaq5n3ul@4ax.com...
[quoted text, click to view]
AddThis Social Bookmark Button