fill listbox with Access.mdb data?

  • Thread starter Thread starter Rich
  • Start date Start date
R

Rich

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 object and an command object
(the commandtext is "Select * from table1"), then added a
dataset object. So I got as far as doing something like
this in a button:

oleCmd.Fill(dataset1)

May I ask if someone could explain how to fill the
listbox? I actually, only need data from the first column
of table1. And I admit that I am a little confused with
the oleadapter and command objects. Do I need both?

Many thanks for any help.
 
Hi Rich,

From this point you can do.
oleCmd.Fill(dataset1)

mylistbox.datasource = dataset1.tables(0)
mylistbox.displaymember = "AnItemFormYourDatabase as in the select"
mylistbox.valuemember="Another item"

Normaly you will show how nice it is filles the listbox.

I hope it goes?

Cor
 
I haven't tried it in dotnet yet, but I would assume you just set the
ListBox.DataSource = Dataset.Tables("YourTable").Columns("YourColumn"

Sean
 
Back
Top