Book a Demo

Author Topic: How to add a package  (Read 3419 times)

Anna

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
How to add a package
« on: September 18, 2008, 02:58:29 am »
hi,

i have a problem again. This time i'm trying to add a package to an existing package.
When i first try to add the package, i get an error message "automation error", in the second try i get the message again and EA crashes. I think it's just funny, that for all that the new package is in die Project Browser. So i think it works, but i don't like EA crashing all the time.

Any suggestions would be nice.

Code: [Select]
Sub AddPackage()

'the boring part
    Dim rep As EA.repository
    Dim pack As EA.package, subpack As EA.package
    Dim dia As EA.Diagram
    
    Set rep = GetObject(, "EA.App").repository
    Set pack = rep.GetPackageByID(50)
    
'the interesting part
    Set subpack = pack.Packages.AddNew("SubPack", "Nothing")
    If Not subpack.Update() Then 'this line causes the error
        MsgBox "error"
    Else
        pack.Packages.Refresh
    End If
    
End Sub

Update:
I just tested the code sample "Add and Manage Packages" and EA also crashes. Is it possible that it's not my fault?
« Last Edit: September 18, 2008, 03:28:35 am by Anna »

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: How to add a package
« Reply #1 on: September 18, 2008, 04:15:31 am »
Quote
Is it possible that it's not my fault?

Nobody's fault but Sparx's:

http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1218908028

So if you're using build 832 and badly need to add packages via automation, you can either wait for 833 or downgrade to 831.

Anna

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: How to add a package
« Reply #2 on: September 23, 2008, 10:42:59 pm »
Thanks, the downgrade helped a lot.