Re: BindingSource.Add raises error

Tech-Archive recommends: Fix windows errors by optimizing your registry



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



.



Relevant Pages

  • ~ folder (backup of address book?) on desktop
    ... For some months now I have had a folder with the "name" ~ ... on my desktop which refuses to be deleted permanently. ... Is there a way to get rid of this irritating object once ...
    (microsoft.public.win2000.general)
  • Re: ~ folder (backup of address book?) on desktop
    ... > on my desktop which refuses to be deleted permanently. ... > update and that it is a backup of my Outlook Express ... > Is there a way to get rid of this irritating object once ...
    (microsoft.public.win2000.general)
  • web directory intruder
    ... over by a home page called web directory sites. ... out of nowhere and refuses to be deleted. ... (which seems to be something to do with microsoft). ... i get rid of it.permanently!!! ...
    (microsoft.public.windowsxp.basics)
  • virus/worm
    ... is there anything i can do to get rid of worm "mslaugh"? ... it refuses to be quarantined or deleted. ...
    (microsoft.public.windowsxp.security_admin)