ASXCollection Usage and Details
Manager Contents
User Contents

ASXCollection.dll is a replacement for the VBA collection class that was used in Visual Basic 6 (VB6) and contains functions, properties and methods that can be used.when operating on collections that are used by CATSWeb (such as colHTML).

  • While VB.NET also has a Collection object type (Microsoft.VisualBasic.Collection), it is incompatible with the VB6 VBA.Collection type.
    • .NET collections do not expose the collection keys.
    • .NET collections are 0 based. VBA Collections are 1 based.
    • Passing a VBA collection to .NET will cause the following error.
      An unhandled exception of type 'System.InvalidCastException' occurred in ApplicationName.exe.
      Additional information: Unable to cast object of type 'Microsoft.VisualBasic.Collection' to type 'VBA.Collection'.
    • The life cycle of Microsoft VB6 support is coming to an end, and AssurX could not depend upon the continued availability of the VBA Collection object type.

  • CATSWeb V6 code relied heavily on VB6 VBA collections (such as colHTML), and modifications to the core code needed to be kept to a minimum to reduce the risk of injecting bugs during the port to .NET.
    • To remain backward compatible with existing VB6 code (including custom ActiveX DLLs), a design decision was made to develop an AssurX collection equivalent (ASXCollection.dll) that provides all of the existing functionality of VBA and Microsoft.VisualBasic collections.
    • The ASXCollection.dll extends the collection functionality with additional methods and properties.

  • Any new Visual Basic .NET code written to interface with CATSWeb, requires the use of the ASXCollection class, and a reference must be added to it within your .NET Class project. The CATSWeb API uses the ASXCollection class as a replacement for the VBA collection class.

  • ASXCollection Constructor:
    1. Defaults to a 1-based collection (similar to a VBA Collection).
      Dim tstASXCol As New ASXCollection.ASXCollection
    2. Uses the value in ‘nBaseType’ as the base (similar to a .NET collection).
      Dim nBaseType as Integer = 0
      Dim tstASXCol = New ASXCollection.ASXCollection(nBaseType)

  • ASXCollection Properties and Examples:
    1. Count: Gets the number of collection items
      Dim tstASXCol As New ASXCollection.ASXCollection
      Dim nCnt As Integer
      Dim strKey As String = "Text3" + "_EDTBL"
      Dim strValue As String = "False"
      tstASXCol.Add(strValue, strKey)
      nCnt = tstASXCol.Coun
      t

  • ASXCollection Methods and Examples:
    1. Add: Add items to the collection:
      • Using a string key:
        Dim strKey As String = "Text3" + "_EDTBL"
        Dim strValue As String = "False"

        tstASXCol.Add(strValue, strKey)
      • Dim strValue As String = "False"
        tstASXCol.Add(strValue)
    2. Remove: Remove items from the collection:
      • Using a string key:
        Dim strKey As String = "Text3" + "_EDTBL"
        tstASXCol.Remove(strKey)
      • Using an index:
        Dim nIndx As Integer = 6
        tstASXCol.Remove(nIndx)
    3. Item: Retrieve items from the collection:
      • Using an index:
        Dim objItem As String = vbEmpty
        Dim nIndx As Integer
        nIndx = 6

        objItem = tstASXCol.Item(nIndx)
      • Using a string key:
        Dim objItem As String = vbEmpty
        Dim strKey As String = "Text3"

        objItem = tstASXCol.Item(strKey)
    4. Detemine if a string key exists within the collection:
      Dim strKey As String = "Text3" + "_EDTBL"
      Dim bResult as Boolean = false
      bResult = tstASXCol.Contains(strKey
      )
      If bResult = True then
      End If

See the CATSWeb ASXCollection Installation And User Guide document for further details on ASXCollection installation and usage.