Bind different data from a list into 3 combo boxes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sree078
    New Member
    • May 2007
    • 9

    Bind different data from a list into 3 combo boxes

    I'm using C#.net windows appln. in VS 2005.

    I've a list
    Code:
    List<string> DataList = new List<string>;
    datalist.add("one");
    datalist.add("two");
    datalist.add("three");
    I need to bind this list to 3 combo boxes.
    Code:
    private void FillMethod()
    {
    comboBox1.BindingContext = new BindingContext();
    comboBox2.BindingContext = new BindingContext();
    comboBox3.BindingContext = new BindingContext();
    
    List<string> list = Filldata();
    comboBox1.DataSource = list;
    comboBox2.DataSource = list;
    comboBox3.DataSource = list;
    
    My requirement is: 
    comboBox1 should have data: "One" & "Two"
    ComboxBox2 should have data: "Two" & "Three"
    comboxBox3 should have data: "One"
    }
    How should I use the list in hand to display in the comboboxes?

    Thanks in advance.
    Last edited by PRR; Apr 13 '09, 01:11 PM. Reason: Please post code in [code] [/code] tags.
  • Bassem
    Contributor
    • Dec 2008
    • 344

    #2
    I think you've to the whole list to a ComboBox or a set of the list data depending on a certain condition, but you're going to bind data that not rely on any condition.
    OK I didn't get a solution, but until you get one, I think you've to define a logical condition to bind a set of DataSource's data.
    Thanks,

    Comment

    Working...