Groups Example?/Problem getting Group information

Nov 8, 2007 at 5:50 PM
Hi all,

I'm trying to do something that should be easy but it isn't working. I'd like to do the following:

1. Get all the groups a user is in.
2. For each group, list the groups and group members (not sure if this will be a problem given how large some groups could be).
3. For each member of a group, get location information.
4. For each member of a group, compare against the user's friends list and see if the user and other group member are friends (keeping track of the total number of friends)

I'm having a difficult time with just step #1 at this point. Here's my code. Any idea what I'm doing wrong? The bold line is where it's breaking:

Dim userGroups As GroupCollection = fbApplication.Service.Groups.GetGroupsByUser(myUser.ID)
sb.Append("Your User Groups:<br/>")
Dim numGroups As Integer = userGroups.Count
Dim i As Integer
For i = 0 To numGroups - 1
sb.Append(userGroups(i).ToString & "<br/>")

The error I'm getting is:
Unable to cast object of type 'System.Collections.Generic.List`1Facebook.Service.Group' to type 'System.Text.RegularExpressions.GroupCollection'.

It seems odd to me that the class for groups is of type System.Text.RegularExpressions. Any idea why this would be?

Thanks in advance for all your help!