Book a Demo

Author Topic: Adding EA.Connector to EA.Element in VBA  (Read 4515 times)

juvanjan

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Adding EA.Connector to EA.Element in VBA
« on: June 11, 2013, 09:14:36 pm »
Hello!

============================================
Dim connector As EA.connector
Dim element As EA.element
Dim element2 As EA.element
    
Set connector = element.Connectors.AddNew("link", "Association")
connector.ClientID = element2.ElementID
    
connector.Update
element.Connectors.Refresh
  
MsgBox (element.Connectors.count)

============================================

I'm having problems adding Connector to an element.
connector.Update  gives an error "Method update of object IDualConnector failed"
MsgBox (element.Connectors.count) shows 0 instead of 1

juvanjan

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Adding EA.Connector to EA.Element in VBA
« Reply #1 on: June 11, 2013, 09:16:11 pm »
Note that I've skipped the part of code where I set element and element1.
Element and element1 are not nothing.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Adding EA.Connector to EA.Element in VBA
« Reply #2 on: June 11, 2013, 10:12:37 pm »
Try setting the supplierID instead of the ClientID.

Geert

juvanjan

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Adding EA.Connector to EA.Element in VBA
« Reply #3 on: June 12, 2013, 12:13:57 am »
It fixed the problem!
By logic I immediately went for clientID.

Thank you, Geert! You'r the man!