我动态地向FlowLayoutPanel添加了多个组合框。如果我在其中一个上收到onchange
,则剩余的组合框也会受到影响。我不想影响其余的组合框。我该怎么办?
foreach(var video in videos)
{
var subvideos = video.Descendants("subvideos");
if (subvideos.Count() >= 1)
{
ComboBox subvideo = new ComboBox();
subvideo.Name = "subvideo" + i;
subvideo.Items.Add(video.Attribute("name").Value);
foreach(var videoname in subvideos)
{
subvideo.Items.Add(videoname.Value);
}
flowlayoutpanel1.Controls.Add(subvideo);
i++;
}
else
{
var text = new TextBox();
text.Text = video.Attribute("name").Value;
flowlayoutpanel1.Controls.Add(text);
}
}