The following are the two lines of code that we have used in the past in VB 6.0 to check all design components in Dx-Designer and pass only those which have symbol type as COMPOSITE. There are no issue with this usage in VB 6.0.
But when we use the same code in VB .NET, we see a exception error getting displayed at the second line of the below code.
Please check and let us know if anything is wrong with this or if there is any other recommended method of checking the symbol type without any exception.
For Each objComp In schApp.DesignComponents("", sTopLevelBlock, "-1", "STD", True)
If objComp.SymbolBlock.SymbolType = VDB_COMPOSITE Then
Note: sTopLevelBlock = gobjProjectData.GetiCDBDesignRootBlock(strDesign) 'Returns Top Level block Name
The exception says 'Unable to Allocate Object Collection'. Enclosed is the snapshot of the same.
I have successfully used the following:
If scomp.SymbolBlock.SymbolType.ToString = "VDB_PIN" Then
Debug.Print("It's a pin")
The text string comparison seems more reliable.