Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyClass
- {
- public int ItemId;
- public string Name;
- public string Other;
- ...
- }
- ...
- BindingList<MYClass> allItems = new BindingList<MyClass>();
- BindingList<MyClass> selectedItems = new BindingList<MyClass>();
- ...
- ListBox1.Datasource = allItems;
- ListBox1.DisplayMember = "Name";
- ListBox1.ValueMember = "ItemId:;
- ...
- ListBox2.DataSource = selectedItems;
- ListBox2.DisplayMember = "Name";
- ListBox2.ValueMember = "ItemId";
- ...
- private void MoveItem(MyObject item, BindingList<MyClass> fromList, BindingList<MyClass> toList)
- {
- toList.Add(item);
- fromList.Delete(item);
- }
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement