14.3 Groups Object

Holds a collection of News server groups.

14.3.1 Count property

Gives the total number of group objects in a particular groups collection.

Syntax

 Object.Count
 

Type

Long.

Attributes

Read-only.

Examples

This example gives the total number of group objects present in the group Test.

 ’Gets the groups available on the server
 Set news =CreateObject("UCX:INews.news") 
 ’Set the IP address
 news.server = "164.99.150.93"
 ’Establish connection with the server
  news.Connect()
 Set groups = news.groups
 Print groups.count
 

14.3.2 HasMoreElements property

Indicates whether there are any more group objects existing in the specified groups collection.

Syntax

 Object.HasMoreElements
 

Type

Boolean.

Attributes

Read-only.

Examples

This example indicates whether there are any more group objects present in a groups collection.

 ’Gets the groups available on the server
 Set news=CreateObject("UCX:INews.news") 
 ’Set the IP address
 news.server = "164.99.150.93"
 ’Establish connection with the server
 news.Connect()
 Set groups = news.Groups
 Status = Groups.Hasmoreelements
 Print Status
 

14.3.3 Element method

Fetches the group objects corresponding to the specified key values.

Syntax

 Object.Element(
  Key As Variant)
 

Parameters

Key
Can be integer or string value. The string value represents the group name and the integer value gives the iterated index of the group to be retrieved

Return values

Group object.

Examples

This example fetches the group objects corresponding to the key value Test and returns the name of the group.

 ’Gets the groups available on the server
 Set news =CreateObject("UCX:INews.news") 
 ’Set the IP address
 news.Server = "164.99.150.93"
 ’Establish connection with the server
 news.Connect()
 Set groups = news.Groups()
 Set group = groups.Element("Test")
 Print group.Name
 

14.3.4 Item method

Returns the group objects corresponding to the specified key values.

Syntax

 Object.Item(
  Key As Variant)
 

Parameters

Key
Can be integer or string value. The string value represents the group name and the integer value gives the iterated index of the group to be retrieved

Return values

Group object.

Examples

This example fetches the group object corresponding to the key value Test and returns the name of the group.

 ’Gets the groups available on the server
 Set news =CreateObject("UCX:INews.news") 
 ’Set the IP address
 news.Server = "164.99.150.93"
 ’Establish connection with the server
 news.Connect()
 Set groups = news.Groups()
 Set group = groups.Element("Test")
 print group.Name
 

14.3.5 Next method

Fetches the next group object from the specified groups collection.

Syntax

 Object.Next()
 

Parameters

None.

Return values

Group object.

Examples

This example sets the pointer to the next group object and returns the group name.

 ’Gets the groups available on the server
 Set news=CreateObject("UCX:INews.news") 
 ’Set the IP address
 news.server = "164.99.150.93"
 ’Establish connection with the server
 news.Connect()
 set groups = news.groups
 groups.reset()
 while groups.hasmoreelements
 set group =groups.next()
 Print group.name
 Wend
 

14.3.6 Reset method

Resets the groups collection.

Syntax

 Object.Reset()
 

Parameters

None.

Return values

None.

Remarks

When the Next method is called after Reset method, it will fetch the first group object from the collection.

Examples

This example resets the groups collection.

 ’Gets the groups available on the server
 Set news=CreateObject("UCX:INews.news") 
 ’Set the IP address
 news.server = "164.99.150.93"
 ’Establish connection with the server
 news.Connect()
 set groups = news.Groups
 groups.Reset()
 If (Err.Number = 0) Then
   Print "The collection is reset"
 Else 
   Print "Unable to reset the collection"
 End if