Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Problem with dynamically added combo boxes

$
0
0

I have some tab pages that I'm dynamically adding combo boxes to. The boxes are all loaded with the same data. My problem is when I make a select in one combobox, the others all change to the selection also.

Below is how I'm adding them:

ComboBox cboSeg = new ComboBox();
         cboSeg.DataSource = segments;
         cboSeg.Width = 75;
         cboSeg.Name = "cbo" + label + "_" + Id;
         if (dr["Segment"] != null && dr["Segment"].ToString() != "")
                cboSeg.SelectedItem = dr["Segment"].ToString();
         cboSeg.Left = cntrlX;
         cboSeg.Top = cntrlY;

If I have data pulled back from the database I'm trying to select it in the combo box but this isn't working either.  Segments is a list<string> that contains the segments I've loaded in the cbo.

Any help would be appreciated.

Thanks,

Rut


Mike Rutledge


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>