Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Cannot not get bound textbox control to sync with Combobox

Cannot not get bound textbox control to sync with Combobox

Scheduled Pinned Locked Moved Visual Basic
questionwpfwcfsales
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rashar
    wrote on last edited by
    #1

    Hello, When my combobox loads with the dataset, my textbox control shows only the first record. How can I set the code below so that as I pick a customer name from the combobox, it also shows the same customer name in my textbox? Me.cboSelectDealer.Enabled = True Me.TblCustomerTableAdapter.Fill(Me.CustomerDataset.tblCustomer) Me.cboSelectDealer.DataSource = CustomerDataset.Tables("tblCustomer") Me.cboSelectDealer.DisplayMember = "Cust_Name" Me.cboSelectDealer.ValueMember = "ID" Me.txtCustomerName.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.CustomerDataset, "tblCustomer.Cust_Name")) Thanks in advance, Rashar

    D 1 Reply Last reply
    0
    • R Rashar

      Hello, When my combobox loads with the dataset, my textbox control shows only the first record. How can I set the code below so that as I pick a customer name from the combobox, it also shows the same customer name in my textbox? Me.cboSelectDealer.Enabled = True Me.TblCustomerTableAdapter.Fill(Me.CustomerDataset.tblCustomer) Me.cboSelectDealer.DataSource = CustomerDataset.Tables("tblCustomer") Me.cboSelectDealer.DisplayMember = "Cust_Name" Me.cboSelectDealer.ValueMember = "ID" Me.txtCustomerName.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.CustomerDataset, "tblCustomer.Cust_Name")) Thanks in advance, Rashar

      D Offline
      D Offline
      Dave Sexton
      wrote on last edited by
      #2

      Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged 'show the selected customer name in a textbox TextBox1.Text = ComboBox1.Text End Sub i hope this is what you meant.

      R 1 Reply Last reply
      0
      • D Dave Sexton

        Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged 'show the selected customer name in a textbox TextBox1.Text = ComboBox1.Text End Sub i hope this is what you meant.

        R Offline
        R Offline
        Rashar
        wrote on last edited by
        #3

        Almost... My form has more than one textbox control, for example, txtCustomerName, txtAddress, txtCity, txtEmail. At design time I can set the binding source to each control's text property as such: txtCustomerName I would set to - TblCustomerBindingSource - Cust_Name txtAddress I would set to - TblCustomerBindingSource - Address txtCity I would set to - TblCustomerBindingSource - City So all my controls would look at their respective dataset, so when I scroll through my combobox, if I picked customer A then I would see the address, city, email etc. for customer a in my textboxes...subsequently if I chose customer B, I would see info for customer B etc. I need to set this up manually, or unless there is a way that I can have multiple bindings to a textbox control because I also need to have those controls look at another table's / bindingsource. Thanks.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups