Book a Demo

Author Topic: Automation in VB.Net  (Read 6415 times)

Darren Lock

  • EA User
  • **
  • Posts: 36
  • Karma: +0/-0
    • View Profile
Automation in VB.Net
« on: August 29, 2002, 09:33:45 am »
How do you create the Interop assembly required to use the EA Automation interface from VB.NET?

Dim x as object
x = CreateObject("EA.Repository") results in 'ActiveX error cannot create object"   ???

The same code from VBScript workds OK.
Darren Lock
United Kingdom

Marc Walter

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Automation in VB.Net
« Reply #1 on: August 29, 2002, 10:08:54 am »
Darren,

The following is working for me:

Public Class EADump
  Public m_Repository As Object
  Private m_rtf As New RTF()

  ' Run the main report
  Public Sub Run(ByVal sInFilename As String, ByVal sOutFilename As String)
     Try
        '  create object
        m_Repository = CreateObject("EA.Repository")
        m_Repository.openfile(sInFilename)

        '  open output file
        m_rtf.OpenFile(sOutFilename)

        '  Dump - this is the report
        DumpModel()

        '  Close things
        m_rtf.CloseFile()

        '  close repository
        m_Repository.exit()
        m_Repository = Nothing
     Catch e As Exception
        m_rtf.WriteParagraph(e.Message)
     End Try
  End Sub
....

Darren Lock

  • EA User
  • **
  • Posts: 36
  • Karma: +0/-0
    • View Profile
Re: Automation in VB.Net
« Reply #2 on: August 29, 2002, 10:11:55 am »
I now realise that the problem is security related as I am invoking the code from ASP.net!

Rgds, Darren.
Darren Lock
United Kingdom

SonnyBoyIII

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
Re: Automation in VB.Net
« Reply #3 on: August 29, 2002, 11:43:34 am »
As a newbie to OOPs, EA, and VB6:

Where do I get the class def for the REPOSITORY?

Darren Lock

  • EA User
  • **
  • Posts: 36
  • Karma: +0/-0
    • View Profile
Re: Automation in VB.Net
« Reply #4 on: August 30, 2002, 11:59:58 pm »
SonnyBoyIII,

the interface is IDispatch, that is, it is late bound. Therefore you can not reference it in vb6. Because it is late bound you will not be able to type the objects or perform compile time checking. All objects are of type object i.e.

dim objEA as object
set objeEA = CreateObject("EA.Repository")

Hope this helps ~8)~
Darren Lock
United Kingdom

Darren Lock

  • EA User
  • **
  • Posts: 36
  • Karma: +0/-0
    • View Profile
Re: Automation in VB.Net
« Reply #5 on: August 31, 2002, 12:02:29 am »
Geoff,

would it be possible to extend Project_Interface.PutDiagramImageToFile to support GIF format?

Rgds, Darren
« Last Edit: August 31, 2002, 12:02:54 am by darrenp_lock »
Darren Lock
United Kingdom