Enumerating Object Collections


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Can someone please confirm that certain collections cannot be enumerated?  For example, the SF ListView and any Business Object are not enumerable objects.  I am unable to run a foreach statement against these collections.  I get an error like this:

foreach statement cannot operate on variables of type 'MicroFour.StrataFrame.UI.Windows.Forms.ListView' because 'MicroFour.StrataFrame.UI.Windows.Forms.ListView' does not contain a public definition for 'GetEnumerator'

Are there others that I may need to be aware of?

Thanks,
Bill

Larry Caylor
Larry Caylor
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
You can enumerate StrataFrame business objectes using the GetEnumerable function. The code would look something like;

For Each loRow As MyBO In Me.MyBO1.GetEnumerable
      MessageBox.Show(loRow.cust_LastName)
Next

I'm not clear on what you mean by enumerating the ListView since you can certainlly enumerate the ListView.Items collection

For Each loItem As Windows.Forms.ListViewItem In Me.ListView1.Items
    
MessageBox.Show(loItem.Tag.ToString)
Next

Where ListView1 is type MicroFour.StrataFrame.UI.Windows.Forms.ListView

-Larry

 


Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Larry Caylor (12/28/2007)
. . . you can certainlly enumerate the ListView.Items collection

For Each loItem As Windows.Forms.ListViewItem In Me.ListView1.Items
    
MessageBox.Show(loItem.Tag.ToString)
Next

Thanks a bunch for the reply!  Happy New Year!!

I have been working too much lately.  I failed to actually point to the Items collection--I was just pointing to the list.  Silly me.  Whistling  I need coffee.

Thanks,
Bill


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search