Home All Groups Group Topic Archive Search About
Author
21 Feb 2006 12:32 PM
guy
why is it that some collection classes, eg BindingList, but others as well do
not expose their Items property? It is there as a Protected property so why
not make it public?

I can work around this but there must be a design reason for this, what is it?

--guy--

Author
21 Feb 2006 1:02 PM
Armin Zingler
"guy" <g**@discussions.microsoft.com> schrieb
> why is it that some collection classes, eg BindingList, but others
> as well do not expose their Items property? It is there as a
> Protected property so why not make it public?
>
> I can work around this but there must be a design reason for this,
> what is it?


BindingList: "Search found no results"

System.Windows.Forms.BindingsCollection.Item, if you mean that, is public.


Armin
Author
21 Feb 2006 1:46 PM
guy
Hi Armin,
my thought was that you cant do a

For Each thing as Object in myBindingList.Items

you have to do something like

For i=1 to myBindingList.Count
  thing=myBindingList.Item(i)

i just wondered why it was designed this way

cheers

guy

Show quoteHide quote
"Armin Zingler" wrote:

> "guy" <g**@discussions.microsoft.com> schrieb
> > why is it that some collection classes, eg BindingList, but others
> > as well do not expose their Items property? It is there as a
> > Protected property so why not make it public?
> >
> > I can work around this but there must be a design reason for this,
> > what is it?
>
>
> BindingList: "Search found no results"
>
> System.Windows.Forms.BindingsCollection.Item, if you mean that, is public.
>
>
> Armin
>
Author
22 Feb 2006 12:46 AM
Jay B. Harlow [MVP - Outlook]
guy,
BindingList does not expose an Items collection as BindingList itself is the
"items" collection.

Instead of:

| For Each thing as Object in myBindingList.Items

Use:

For Each thing as Object in myBindingList



FWIW: If you have a type that has an "Items" collection that suggests that
you have a type that *has* a collection. Classes such as BindingList (that
have a Count & Item properties, GetEnumerator method) *are* a collection.
Generally For Each requires that the type implement IEnumerable or
IEnumerable(Of T). However For Each can operate on types that have a
GetEnumerator method without implementing either interface... Unfortunately
I don't have the link handy on the specifics of what For Each looks for...

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


Show quoteHide quote
"guy" <g**@discussions.microsoft.com> wrote in message
news:86B7B2DD-BA38-4C89-A9C5-E8CF6A276F3E@microsoft.com...
| Hi Armin,
| my thought was that you cant do a
|
| For Each thing as Object in myBindingList.Items
|
| you have to do something like
|
| For i=1 to myBindingList.Count
|  thing=myBindingList.Item(i)
|
| i just wondered why it was designed this way
|
| cheers
|
| guy
|
| "Armin Zingler" wrote:
|
| > "guy" <g**@discussions.microsoft.com> schrieb
| > > why is it that some collection classes, eg BindingList, but others
| > > as well do not expose their Items property? It is there as a
| > > Protected property so why not make it public?
| > >
| > > I can work around this but there must be a design reason for this,
| > > what is it?
| >
| >
| > BindingList: "Search found no results"
| >
| > System.Windows.Forms.BindingsCollection.Item, if you mean that, is
public.
| >
| >
| > Armin
| >
Author
21 Feb 2006 2:10 PM
guy
sorry Armin i should have made it clear, i am using vb2005, and it is the
System.ComponentModel.BindingList that i am refering to

Show quoteHide quote
"Armin Zingler" wrote:

> "guy" <g**@discussions.microsoft.com> schrieb
> > why is it that some collection classes, eg BindingList, but others
> > as well do not expose their Items property? It is there as a
> > Protected property so why not make it public?
> >
> > I can work around this but there must be a design reason for this,
> > what is it?
>
>
> BindingList: "Search found no results"
>
> System.Windows.Forms.BindingsCollection.Item, if you mean that, is public.
>
>
> Armin
>
Author
21 Feb 2006 3:47 PM
Armin Zingler
Show quote Hide quote
"guy" <g**@discussions.microsoft.com> schrieb
>
> > "guy" <g**@discussions.microsoft.com> schrieb
> > > why is it that some collection classes, eg BindingList, but
> > > others as well do not expose their Items property? It is there
> > > as a
> > > Protected property so why not make it public?
> > >
> > > I can work around this but there must be a design reason for
> > > this, what is it?
> >
> >
> > BindingList: "Search found no results"
> >
> > System.Windows.Forms.BindingsCollection.Item, if you mean that, is
> > public.
>
> sorry Armin i should have made it clear, i am using vb2005, and it
> is the System.ComponentModel.BindingList that i am refering to


It's also not found in VB 2005.

.....later....

I had to enter "bindglist(of t)"  in order to find it. What a new nonsense.
:-((((( When I press F1 then, the topic is not found. I love it.

Sorry, I can not help you.


Armin
Author
21 Feb 2006 4:05 PM
guy
thanks Armin - i only found it via google - not MSDN!

lol

guy

Show quoteHide quote
"Armin Zingler" wrote:

> "guy" <g**@discussions.microsoft.com> schrieb
> >
> > > "guy" <g**@discussions.microsoft.com> schrieb
> > > > why is it that some collection classes, eg BindingList, but
> > > > others as well do not expose their Items property? It is there
> > > > as a
> > > > Protected property so why not make it public?
> > > >
> > > > I can work around this but there must be a design reason for
> > > > this, what is it?
> > >
> > >
> > > BindingList: "Search found no results"
> > >
> > > System.Windows.Forms.BindingsCollection.Item, if you mean that, is
> > > public.
> >
> > sorry Armin i should have made it clear, i am using vb2005, and it
> > is the System.ComponentModel.BindingList that i am refering to
>
>
> It's also not found in VB 2005.
>
> .....later....
>
> I had to enter "bindglist(of t)"  in order to find it. What a new nonsense.
> :-((((( When I press F1 then, the topic is not found. I love it.
>
> Sorry, I can not help you.
>
>
> Armin
>
>
Author
21 Feb 2006 5:55 PM
Cor Ligthert [MVP]
Armin,

Did you try this one already?

http://lab.msdn.microsoft.com/search/?query=ComponentModel.BindingList+

All compactframework as far as I saw.

Cor
Author
21 Feb 2006 6:22 PM
Armin Zingler
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schrieb
> Armin,
>
> Did you try this one already?
>
> http://lab.msdn.microsoft.com/search/?query=ComponentModel.BindingList+
>
> All compactframework as far as I saw.


I would have found it on my own, but my time is also limited.

Thx anyway. :-)




Armin
Author
21 Feb 2006 6:50 PM
Chris Dunaway
Author
21 Feb 2006 7:14 PM
CMM
F1 in VS2005 SUCKS! (most of the time).

--
-C. Moya
www.cmoya.com
Show quoteHide quote
"Armin Zingler" <az.nospam@freenet.de> wrote in message
news:%23MwRG9vNGHA.2624@TK2MSFTNGP12.phx.gbl...
> "guy" <g**@discussions.microsoft.com> schrieb
>>
>> > "guy" <g**@discussions.microsoft.com> schrieb
>> > > why is it that some collection classes, eg BindingList, but
>> > > others as well do not expose their Items property? It is there
>> > > as a
>> > > Protected property so why not make it public?
>> > >
>> > > I can work around this but there must be a design reason for
>> > > this, what is it?
>> >
>> >
>> > BindingList: "Search found no results"
>> >
>> > System.Windows.Forms.BindingsCollection.Item, if you mean that, is
>> > public.
>>
>> sorry Armin i should have made it clear, i am using vb2005, and it
>> is the System.ComponentModel.BindingList that i am refering to
>
>
> It's also not found in VB 2005.
>
> ....later....
>
> I had to enter "bindglist(of t)"  in order to find it. What a new
> nonsense. :-((((( When I press F1 then, the topic is not found. I love it.
>
> Sorry, I can not help you.
>
>
> Armin