PC Review


Reply
Thread Tools Rate Thread

Filling a list box from a table

 
 
John
Guest
Posts: n/a
 
      31st Dec 2007
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


 
Reply With Quote
 
 
 
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      31st Dec 2007
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

 
Reply With Quote
 
dgcarter@hotmail.com
Guest
Posts: n/a
 
      1st Jan 2008
On Mon, 31 Dec 2007 11:06:16 +0100, "Cor Ligthert[MVP]"
<(E-Mail Removed)> wrote:

>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
 
Reply With Quote
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      1st Jan 2008
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

<(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> On Mon, 31 Dec 2007 11:06:16 +0100, "Cor Ligthert[MVP]"
> <(E-Mail Removed)> wrote:
>
>>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


 
Reply With Quote
 
dgcarter1949@googlemail.com
Guest
Posts: n/a
 
      2nd Jan 2008
On 1 Jan, 17:02, "Cor Ligthert[MVP]" <notmyfirstn...@planet.nl> wrote:
> 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
>
> <dgcar...@hotmail.com> schreef in berichtnews:(E-Mail Removed)...
>
>
>
> > On Mon, 31 Dec 2007 11:06:16 +0100, "Cor Ligthert[MVP]"
> > <notmyfirstn...@planet.nl> wrote:

>
> >>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- Hide quoted text -

>
> - Show quoted text -


Thanks Cor,

I'll give that a try.

Don
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filling a list box from a table John Microsoft ADO .NET 4 2nd Jan 2008 10:25 PM
Filling a list box from a table John Microsoft VB .NET 3 1st Jan 2008 06:02 PM
filling a list box from a table mlarsen1982@aol.com Microsoft VB .NET 1 2nd Aug 2007 09:08 PM
Shape.Table goes missing when filling Powerpoint table with Excel =?Utf-8?B?R2xlbm4gSA==?= Microsoft Powerpoint 1 14th Aug 2006 04:01 AM
auto fill field in a table by filling one field in list box Jeffrey Reed Microsoft Access Queries 1 21st Oct 2003 10:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:22 PM.