Combobox binding problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Combobox binding problem

Hybrid View

  1. #1
    Join Date
    Jun 2004
    Posts
    1

    Combobox binding problem

    Hello
    I've two combobox in my win form and i try to bind them to a city table in my dataset.the problem is this:
    When I try to change one combobox the other one's value also changes and i don't want this becuse one combobox is for working city and the other is Born Place
    Thanks in advance
    Behdad Khoshbin

  2. #2
    Join Date
    Dec 2003
    Location
    Melbourne, Australia
    Posts
    52
    This is because, by default, all controls on a form use the form's BindingContext. Add the following code to your form:

    cboManager.BindingContext = New BindingContext
    cboAssistant.BindingContext = New BindingContext

    (This is assuming your problem combos are called cboManager/cboAssistant).

    Of course, you only really have to create a new binding context for one of the combos for them to be using different contexts, I just like to treat mine consistently :-)

  3. #3
    Join Date
    Jun 2004
    Posts
    2
    Hi,

    You can also create a copy of the dataset and then bind this copy. This works fine.

    Regqrds
    Lucas

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center