Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 86,266 VB.NET Programmers. There are 1,884 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a VB.NET Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

Populating comboboxes

 
Reply to this topicStart new topic

Populating comboboxes

MichealDiablos
post 7 May, 2008 - 06:38 AM
Post #1


New D.I.C Head

*
Joined: 6 May, 2008
Posts: 1



Hi I have been trying to populate a combobox called Vic but was unable since it couldnt save in the database.
Here's the code i used:
CODE

'Connect to the database
        custcon = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + Application.StartupPath + "\..\..\Transport.mdb")
        custcon.Open()

        'Establish School command object
        custcom = New OleDbCommand("Select * From Repairs", custcon)
        custcom2 = New OleDbCommand("Select VehicleID From Vehicle", custcon)

        'Establish School data adapter/data table
        custadap = New OleDbDataAdapter
        custadap2 = New OleDbDataAdapter
        custadap.SelectCommand = custcom
        custadap2.SelectCommand = custcom2
        custtab = New DataTable
        custtab2 = New DataTable
        custadap.Fill(custtab)
        custadap2.Fill(custtab2)

        'Bind controls
        txtID.DataBindings.Add("Text", custtab, "RepairsID")
        txtcost.DataBindings.Add("Text", custtab, "Amount")
        txtdes.DataBindings.Add("Text", custtab, "Description")
        DateTimePicker1.DataBindings.Add("Text", custtab, "Done")
        cboVic.DataBindings.Add("Text", custtab, "VehicleID")

        'Populate the combobox
        Me.cboVic.DataSource = Me.custtab2
        Me.cboVic.DisplayMember = "VehicleID"
        Me.cboVic.ValueMember = "VehicleID"
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


Fast ReplyReply to this topicStart new topic
Time is now: 5/16/08 10:26AM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month