473,466 Members | 1,413 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

fill listbox with Access.mdb data?

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.

Nov 20 '05 #1
3 6411
Cor
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
Nov 20 '05 #2
I haven't tried it in dotnet yet, but I would assume you just set the
ListBox.DataSource = Dataset.Tables("YourTable").Columns("YourColumn"

Sean
Nov 20 '05 #3
Thank you all for your replies. I will try out the
suggestions.

-----Original Message-----
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.

.

Nov 20 '05 #4

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

Similar topics

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: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name...
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: Vaughn | last post by:
I have a textbox in my Win form that can be filled when a user chooses an emplcode from a combobox and when the value is returned from another form (double-clicks on a separate listbox). What...
3
by: Hrvoje Voda | last post by:
How to Fill a listbox with data from database? Hrcko
6
by: Chris Leuty | last post by:
I am populating a multiselect Listbox from a dataset, with the content of the listbox filled by one table, and the selections determined from another table. So far, I have been keeping the dataset...
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 |...
5
by: Tark Siala | last post by:
hi dear i'm programmer with VB6, but now i starting with C#. first problem is coming when i need fill "ComboBox Control", as you know when i fill combobox in VB6 by this code: comboX.AddItem...
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.