D
Damien Sawyer
Hi, I am having trouble understanding how to access the items in an
ArrayList. From MSDN, "(an ILIST) Represents a collection of objects
that can be individually accessed by index."
This is exactly what I'm trying to do with an ArrayList bound to a
datagrid, however am having troubles. The ArrayList contains
'Department' objects....
I've included snippets from the immediate window to show what I'm
trying to do...
1/ I'm pretty sure that it's an ArrayList that I'm dealing with
? ((ArrayList)this.dataGrid1.DataSource).GetType
((System.Collections.ArrayList)()).GetType+0 // method+offset
2/ It does contain items.
? ((ArrayList)this.dataGrid1.DataSource)
{Count=7}
[0]: {nhRegistration.Department}
[1]: {nhRegistration.Department}
[2]: {nhRegistration.Department}
... etc
3/ However there appears to be no indexer or other Method that I can
use.
? ((ArrayList)this.dataGrid1.DataSource)[1] // wish to get object 1 in
collection
error: object '(ArrayList)this.dataGrid1.DataSource' doesn't have an
indexer
Can someone please explain what I'm doing wrong?
Thanks in advance.
Damien Sawyer
ArrayList. From MSDN, "(an ILIST) Represents a collection of objects
that can be individually accessed by index."
This is exactly what I'm trying to do with an ArrayList bound to a
datagrid, however am having troubles. The ArrayList contains
'Department' objects....
I've included snippets from the immediate window to show what I'm
trying to do...
1/ I'm pretty sure that it's an ArrayList that I'm dealing with
? ((ArrayList)this.dataGrid1.DataSource).GetType
((System.Collections.ArrayList)()).GetType+0 // method+offset
2/ It does contain items.
? ((ArrayList)this.dataGrid1.DataSource)
{Count=7}
[0]: {nhRegistration.Department}
[1]: {nhRegistration.Department}
[2]: {nhRegistration.Department}
... etc
3/ However there appears to be no indexer or other Method that I can
use.
? ((ArrayList)this.dataGrid1.DataSource)[1] // wish to get object 1 in
collection
error: object '(ArrayList)this.dataGrid1.DataSource' doesn't have an
indexer
Can someone please explain what I'm doing wrong?
Thanks in advance.
Damien Sawyer