I am upgrading a program from V8i to CONNECT Update 15. The V8i code had an instance of the Application class declared as follows:
Private WithEvents msApp As Bentley.Interop.MicroStationDGN.Application = Nothing
And thencode to handle the OnDesignFileOpened event:
Public Sub DesignFileOpened(ByVal Filename As String) Handles msApp.OnDesignFileOpened
This works in v8i. In CONNECT I get the following error:
Error BC30590 Event 'OnDesignFileOpened' cannot be found.
Can someone tell me how to upgrade this or what I am doing wrong?
please be aware this is general Developers and Programming forum. Because your question is about MicroStation, I recommend to move it to MicroStation Programming forum.
To move existing discussion to another forum, use More > Move tool, available under your original post. Please do not duplicate the post!
WarrenC said:The V8i code had an instance of the Application class
Can you share more information about your application?
There is no information about context shared, so we can guess only it is external process application, accessing MicroStation using Interop assembly. Because of weird language used, I guess it is VB.NET?
WarrenC said:as follows
Please, use Insert > Insert code tool every time, when you want to share a code snippet!
To read code, formatted as plain text, is confusing.
WarrenC said:Can someone tell me how to upgrade this or what I am doing wrong?
The events exist (at least what I see in the assembly itself).
I do not know VB.NET well, but is your application set to be 64bit, using the right Framework version, and referencing the right Interop?
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Thanks for the reply. My application is set to 64 bit, using .Net framework 4.6.2 and is referencing the U15 interop.
Thanks for the help.
WarrenC said:Event 'OnDesignFileOpened' cannot be found
If you create a VBA macro, does that compile OK?
Dim WithEvents hooks As Application
Private Sub Class_Initialize()
Set hooks = Application
Private Sub hooks_OnDesignFileClosed(ByVal DesignFileName As String)
Debug.Print "Closed design file " & DesignFileName
Private Sub hooks_OnDesignFileOpened(ByVal DesignFileName As String)
Debug.Print "Opened design file " & DesignFileName
Regards, Jon Summers LA Solutions
I am not all that familiar with VBA. I will give it a try.