D
David H
I'm getting stumped on what should be a simple problem.
I have data class (ActionList) that inherits from CollectionBase and
implements the abstract members. I want to be able to bind an instance
of this class to a ListBox control so that the updates to the
underlying ActionList will be reflected in the ListBox.
So far, the closest I can get is something along these lines:
ActionList list=new ActionList();
ListBox1.DataSource=list;
list.Add(new (ActionItem("Action!"));
ListBox1.DisplayMember="ActionName";
This (sorta) works. In order to get the ListBox to update, I must do
this:
LisBox1.DataSource=null;
ListBox1.DataSource=list;
The other problem is that despite the fact that I'm setting the
DisplayMemeber, all I get is the default string representation of the
item .
Can someone tell me what I'm missing here?
Thanks in advance,
David
I have data class (ActionList) that inherits from CollectionBase and
implements the abstract members. I want to be able to bind an instance
of this class to a ListBox control so that the updates to the
underlying ActionList will be reflected in the ListBox.
So far, the closest I can get is something along these lines:
ActionList list=new ActionList();
ListBox1.DataSource=list;
list.Add(new (ActionItem("Action!"));
ListBox1.DisplayMember="ActionName";
This (sorta) works. In order to get the ListBox to update, I must do
this:
LisBox1.DataSource=null;
ListBox1.DataSource=list;
The other problem is that despite the fact that I'm setting the
DisplayMemeber, all I get is the default string representation of the
item .
Can someone tell me what I'm missing here?
Thanks in advance,
David