You are here: MessengerYouLike.IMSDK > IMSDK Reference > IMSDK Namespace > Classes > Friends Class > Friends Methods > Friends.Count Method
MessengerYouLike
Friends.Count Method

This Method shows the total number of IMSDK.Friends.MFriend in this collection

C#
public int Count();
Visual Basic
Public Function Count() As Integer

This Class is a collection of IMSDK.Friends.MFriend so this method tells how many objects or IMSDK.Friends.MFriend are there

[Visual Basic]
 
'Create a new IMClient
Dim MC as new IMSDK.IMClient
 
 
 
'Create a new MCUser
 Public MCUser As New IMSDK.User
 
 
 
'Call the Listen Sub
MC.Listen()
 
 
 
'Now Try to login
MC.BeginLogin(TxtUsername.Text,TxtPassword.Text)
 
 
 
'if username and password is valid then
Private Sub MC_OnLoggedin(ByVal UserObject As IMSDK.User) Handles MC.OnLoggedin
    Debug.WriteLine("Username logged in : " & MCUser.Username & " , " & MCUser.Password)
 
        MCUser = New IMSDK.User
        MCUser = UserObject
        Msgbox("Username is " & MCUser.Username)
 
End Sub
 
 
 
'if username or password is invalid then
Private Sub MC_OnUsernameOrPasswordInvalid(ByVal Username As String, ByVal Password As String) Handles MC.OnUsernameOrPasswordInvalid
  Debug.WriteLine("Username password invalid : " & Username & " , " & Password)
End Sub
 
 
 
 
   Function loadlv2() As Boolean
        FriendsTV.Nodes.Clear()
 
 
 
        For i As Integer = 0 To MCUser.Groups.Count - 1
            Dim nd2 As New TreeNode
            With nd2
 
                .ToolTipText = "Online = " & MCUser.Groups.Item(i).TotalOnlineFriends.ToString & _
               "Offline = " & MCUser.Groups.Item(i).TotalOfflineFriends.ToString & _
               "Busy = " & MCUser.Groups.Item(i).TotalBusyFriends.ToString & _
               "unauthorized = " & MCUser.Groups.Item(i).TotalUnAuthFriends
 
                .Text = MCUser.Groups.Item(i).GroupName & " ( " & MCUser.Groups.Item(i).TotalOnlineFriends.ToString & " / " & MCUser.Groups.Item(i).TotalFriends.ToString & " )"
                .Tag = MCUser.Groups.Item(i).UID
            End With
 
            FriendsTV.Nodes.Add(nd2)
 
            Dim fr As IMSDK.Friends = MCUser.Groups.Item(i).Friends
 
            For j As Integer = 0 To fr.Count - 1
                Dim nd3 As New TreeNode
 
                With nd3
                    .Text = fr.Item(j).FriendUsername & " - " & fr.Item(j).FriendStatus.ToString & " - " & fr.Item(j).FriendAuthStatus.ToString & " - " & fr.Item(j).Blocked.ToString & " - " & fr.Item(j).AmIBlocked.ToString
                    .Tag = fr.Item(j).FriendUsername
                End With
 
                FriendsTV.Nodes.Item(FriendsTV.Nodes.IndexOf(nd2)).Nodes.Add(nd3)
 
            Next j
 
        Next i
 
        FriendsTV.ExpandAll()
        FriendsTV.Visible = True
 
    End Function
Copyright (c) 2007. All rights reserved.