Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.
Imports System.Data Imports System.Data.OleDb Public Class Form1 Dim DbConnection As OleDbConnection Dim InvoiceCommand As OleDbCommand Dim InvoiceAdapter As OleDbDataAdapter Dim InvoiceTable As DataTable Dim InvoiceManager As CurrencyManager Dim CustomerCommand As OleDbCommand Dim CustomerAdapter As OleDbDataAdapter Dim CustomerTable As DataTable Dim CustomerManager As CurrencyManager Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'connect to database DbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source = c:\Database2.mdb") DbConnection.Open() 'establish command object InvoiceCommand = New OleDbCommand("Select * from tblInvoice ORDER BY CustomerName", DbConnection) 'establish data adapter/data table InvoiceAdapter = New OleDbDataAdapter() InvoiceAdapter.SelectCommand = InvoiceCommand InvoiceTable = New DataTable() InvoiceAdapter.Fill(InvoiceTable) 'bind controls to data table txtName.DataBindings.Add("Text", InvoiceTable, "CustomerName") txtAddress.DataBindings.Add("Text", InvoiceTable, "Address") txtCity.DataBindings.Add("Text", InvoiceTable, "City") 'establish customer table/combo box to pick customer CustomerCommand = New OleDbCommand("Select * from TblCustomer ORDER BY CustomerID", DbConnection) CustomerAdapter = New OleDbDataAdapter() CustomerAdapter.SelectCommand = CustomerCommand CustomerTable = New DataTable() CustomerAdapter.Fill(CustomerTable) ComboBox1.DataSource = CustomerTable ComboBox1.DisplayMember = "CustomerID" ComboBox1.ValueMember = "CustomerID" ' ComboBox1.DataBindings.Add("SelectedValue", InvoiceTable, "CustomerName") End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged txtName.Text = ComboBox1.SelectedText End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.