| Platform SDK: Transaction Server |
[This product will work only on Windows NT 4.0 versions and earlier. For Windows 2000 and later, see COM+ (Component Services).]
To enumerate through installed components to delete a component:
Dim catalog As Object Dim packages As Object Dim pack As Object Dim componentsInPack As Object Dim util As Object
On Error GoTo failed
Set catalog = CreateObject("MTSAdmin.Catalog.1")
Set packages = catalog.GetCollection("Packages")
packages.Populate
For Each pack In packages
If pack.Name = "My Package" Then
Set componentsInPack = packages.GetCollection("ComponentsInPackage", pack.Key)
componentsInPack.Populate
For i = 0 To componentsInPack.Count
Set comp = componentsInPack.Item(i)
If comp.Name = "Bank.Account" Then
componentsInPack.Remove (i)
componentsInPack.savechanges
Exit For
End If
Next
Exit For
End If
Next
Exit Sub
failed:
MsgBox "Failure code " + Str$(Err.Number)
End Sub
See Also
MTS Administration Objects, MTS Collection Types, MTS Administration Object Methods, Automating Advanced MTS Administration with Visual Basic