Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 16-08-2008, 10:09 PM   #1 (permalink)
In The Zone
 
arian29's Avatar
 
Join Date: Feb 2008
Location: New Delhi
Posts: 212
Question VB6 Help pls...


How to connect a list box to a access database so that the list is populated with the data in the access table for VB6 ?
arian29 is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 17-08-2008, 07:37 AM   #2 (permalink)
Alpha Geek
 
Amir.php's Avatar
 
Join Date: Feb 2007
Location: Allahabad
Posts: 786
Default Re: VB6 Help pls...

Quote:
Create a form with list box
Create reference to database [ msado25.dll ] or you can use any version.

Dim objCnn As New ADODB.Connection
Dim objRss As New ADODB.Recordset
Private Sub Form_Load()

objCnn.ConnectionString = "Provide your connection string here"
objCnn.Open

Set objRss = objCnn.Execute("Select <fieldName> from <tablename>")
Do While Not objRss.EOF
lstUsers.AddItem objRss.Fields(0).Value
objRss.MoveNext
Loop

This will populate the list box with values.

In design mode itself you can set the Style property of the list box to 1-Checkbox
Or through code you can do like lstUsers.Style = 1.
.................................................. .............................................

Last edited by Amir.php; 17-08-2008 at 07:42 AM.
Amir.php is offline  
Old 17-08-2008, 09:51 AM   #3 (permalink)
Legen-wait for it-dary!
 
dheeraj_kumar's Avatar
 
Join Date: Dec 2004
Location: Chennai
Posts: 2,471
Default Re: VB6 Help pls...

^^ Amir, next time, post with the source please.

Source: http://www.experts-exchange.com/Prog..._21568679.html
__________________
If the Start Windows Restart when Windows starts check box is checked Windows Restart will start automatically every time Windows is started. - Actual excerpt from a windows program help file
dheeraj_kumar is offline  
Old 01-09-2008, 04:00 PM   #4 (permalink)
javed4shab
Guest
 
Posts: n/a
Thumbs up Re: VB6 Help pls...

Boss,
You can Use "Data List" or "Data COmbo" boxes. These are available in "VB Enterprise Edition Controls."
and set properties :
datasource = adodc1
rowsource = adodc1
listfield = "name of field which you want to add to list"
Works best for want you want.

Enjoy
 
Closed Thread

Bookmarks

Thread Tools
Display Modes

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 On


 
Latest Threads
- by Sujeet
- by clmlbx
- by Sujeet
- by icebags

Advertisement




All times are GMT +5.5. The time now is 11:10 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2