Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5
This is the forum to discuss the Wrox book Beginning Visual Basic 2005 Databases by Thearon Willis; ISBN: 9780764588945
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old December 5th, 2010, 09:33 PM
Authorized User
Join Date: Nov 2007
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 5 Exercise 1 ComboBox not filling

I am working through the book and have tried the solutions code from appendix c for Chapter 5 exercise 1 but the combobox doesn't populate with any data. I'm not getting any errors just no data in the comboBox. Here is the code I used. If someone could look it over and point out any errors I would be greatful
Imports System.Data
Imports System.Data.OleDb
'form level variables
Private strConnectionString AsString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\ProjectTimeTracker.mdb;"
Private objConnection AsOleDbConnection
Private objCommand AsOleDbCommand
Private objDataAdapter AsOleDbDataAdapter
Private objDataTable AsDataTable
PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
'initialize the Connection object
objConnection = NewOleDbConnection(strConnectionString)
'initialize the command object
objCommand = NewOleDbCommand("SELECT ProjectID, ProjectName FROM Projects", objConnection)
'initialize the DataAdapter object and set the SelectCommand property
objDataAdapter = NewOleDbDataAdapter
objDataAdapter.SelectCommand = objCommand
'initialize the DataTable object
objDataTable = NewDataTable
'populate the DataTable
'bind the DataTable to the ComboBox
cboProjects.DataSource = objDataTable
cboProjects.DisplayMember =
cboProjects.ValueMember = "ProjectID"
'clean up
objCommand =
objConnection =
objDataAdapter =
objDataTable =
Reply With Quote
  #2 (permalink)  
Old December 6th, 2010, 07:14 PM
Authorized User
Join Date: Nov 2007
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

Ok redid the project using exactly the same code but I switched framework from .net 4 to the 2.0 framework and it worked correctly. Is there a difference in the way you do this under the .net 4 framework?
Reply With Quote

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filling ComboBox from Dataset dcathers C# 9 June 15th, 2013 03:31 AM
Filling a combobox/listbox unmeshraut VB How-To 1 September 21st, 2007 12:08 PM
Filling comboBox from an XML File kuznickic C# 2005 11 August 29th, 2007 01:54 AM
Filling SubForm from ComboBox ayazhoda Access VBA 4 June 5th, 2007 10:56 AM
Filling Combobox with value from other Combobox ayazhoda Access VBA 6 June 5th, 2007 04:58 AM

All times are GMT -4. The time now is 11:45 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.