Listbox jest podmontowany pod DataBindingSource. Problem mam żeby podpiąć pod ComboBoxa List<string>. Czyli dla aktualnego obiektu w ListBoxie, w Combo mają być wyświetlone jego elementy listy Address
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
textBox1.DataBindings.Add("Text", bindingSource1, "Name", true, DataSourceUpdateMode.OnPropertyChanged);
//comboBox1.DataSource = listBox1.SelectedItem;
//comboBox1.DisplayMember = "Address";
}
private void button1_Click(object sender, EventArgs e)
{
Test t = new Test();
t.Name = "TEST";
t.Address.Add("AAA");
t.Address.Add("BBB");
bindingSource1.Add(t);
}
}
public class Test
{
public Test()
{
Address = new List<string>();
}
public string Name
{
get;
set;
}
public List<string> Address
{
get;
set;
}
}
}
- listbox.zip (46 KB) - ściągnięć: 101