
Signature
Lucas Tam (REMOVEnntp@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Hey Lucas,
when I add it like this, I get an error message.
lbDescription.DataSource = _dt
lbDescription.DisplayMember = "Description"
lbDescription.ValueMember = "CodesID"
lbDescription.Items.Add("<New>")
I get this error:
An unhandled exception of type 'System.ArgumentException' occurred in
system.windows.forms.dll
Additional information: Cannot modify the Items collection when the
DataSource property is set.
> > I was wondering if you databind to a listbox, can you at the same time
> > have an extra item in there like say, <new> ?
>
> Yes. Just add the item AFTER the databind.
Lucas Tam - 25 Sep 2004 16:13 GMT
> I get this error:
> An unhandled exception of type 'System.ArgumentException' occurred in
> system.windows.forms.dll
>
> Additional information: Cannot modify the Items collection when the
> DataSource property is set.
Hmm, it works with Webforms, I guess I never tried it with Winforms.
Try adding the item to the dataset ... then binding it. That should work
for sure.

Signature
Lucas Tam (REMOVEnntp@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/