Re: BindingSource.Add raises error
- From: Simon <simon_nospam_rigby@xxxxxxxxxxxx>
- Date: Thu, 08 Dec 2005 10:56:29 +0000
Hi Bart,
That's got rid of my error so now the application starts and the form displays correctly. However, if I now select the option (the only one at the moment, although there will be more), I can't leave the combo box. It has grabbed the focus and refuses to let go. Even attempting to close the application with the Close Box refuses to respond.
Any ideas?
Simon
Bart Mermuys wrote:
Hi,
"Simon" <simon_nospam_rigby@xxxxxxxxxxxx> wrote in message news:%23NaYCpz%23FHA.952@xxxxxxxxxxxxxxxxxxxxxxx
I have a combobox on a form bound to a bindingSource. DataSource is derived
from BindingList as follows:
public class RendererList : BindingList<RendererListItem> {
public RendererList() { Add(new RendererListItem("Active Server Pages")); }
}
In my form I am calling the Add method to set the source
rendererListBindingSource.Add(_renList);
You should set the DataSource : renderListBindingSource.DataSource = _renList;
rendererListBindingSource.Add is for adding items to the list the rendererListBindingSource is backing.
HTH, Greetings
_renList is an instance of RendererList which is instantiated at declaration
ie RenderList _renList = new RenderList();
I am getting the error:
InvalidOperationException : Objects added to a BindingSource's list must all be of the same type.
I've had this error before when I tried to add a collection to the bindingSource which WASN'T derived from BindingList.
I appreciate this isn't srictly ADO.NET but I seem to find that the best advice about databinding can be found in this group.
Any ideas.
Many Thanks
Simon
.
- Follow-Ups:
- Re: BindingSource.Add raises error
- From: Bart Mermuys
- Re: BindingSource.Add raises error
- References:
- BindingSource.Add raises error
- From: Simon
- Re: BindingSource.Add raises error
- From: Bart Mermuys
- BindingSource.Add raises error
- Prev by Date: Re: Pessimistic Locking
- Next by Date: Re: Pessimistic Locking
- Previous by thread: Re: BindingSource.Add raises error
- Next by thread: Re: BindingSource.Add raises error
- Index(es):
Relevant Pages
|