1 Reply Latest reply: Dec 29, 2017 8:10 AM by Mo Abdolrahim RSS

    Reference to Monarch Com not found in visual studio 17

    mhumphri _

      I recently upgraded my PC (64bit Win 7 Enterprise) with Visual Studio Professional 2017.  I have Monarch V13 64bit with the programming license.  When I write a program in vb.net and attempt to add reference to the Monarch com object  its not there.  When I create a simple program to create the Monarch object a vb form window pops up and the software hangs.  I tend to call Monarch with the same parameters alot so I wanted to make a class library DLL that executes the Monarch routines.  Then I could use this DLL in several of my programs but I have had no luck after almost a month of development. 

      So I have two questions.  Why doesn't monarch show up as a reference to add in my vb project reference?

      Is it possible to make a DLL and call the Monarch routines and stick it in a class library for future use.


      Actually I have lots of questions but those are the main two.  If I have Monarch 64 why do we create object Monarch32?  Shouldn't it be Monarch64?  Should I build the project for x86 and not a 64 bit ?

        • Re: Reference to Monarch Com not found in visual studio 17
          Mo Abdolrahim

          Create a console project and add a reference to the Monarch,exe per following screenshot. I installed Monarch v14.2, 64 bit and I am using the Visual Studio 2012.

          Add the following subroutine to the console project.  The script assumes that the model and report files are in the proper folders, and all three folders (reports, nodes, and export) exist.  You also need a license that allows you to programmatically reference Monarch com object.

             Sub Main()

             Dim MonarchObj As new Datawatch.Desktop.Automation.MonarchAutomationObject

             Dim strPassword As String = ""

             Dim bAppend As Boolean = False

             Dim openfile, openmod As Boolean

             Const ReportFolder = "C:\Users\Public\Documents\Datawatch Monarch\Reports\"

             Const ModelFolder = "C:\Users\Public\Documents\Datawatch Monarch\Models\"

             Const ExportFolder = "C:\Users\Public\Documents\Datawatch Monarch\Export\"


                openfile = MonarchObj.SetReportFile(ReportFolder & "classic.prn", strPassword, bAppend)

                openmod = MonarchObj.SetModelFile(ModelFolder & "Lesson9.dmod")

               If openfile = True And openmod = True Then

                 'Set filter and export to Excel XLS

                 MonarchObj.CurrentFilter = "Fandangos Records"

                 MonarchObj.ExportTable (ExportFolder & "Fandangos.xls")

                 MonarchObj.CurrentFilter = "No Returns"

                 MonarchObj.ExportTable (ExportFolder & "No_Returns.xls")


                'Error handling here

               End If

             Catch ex As Exception

               Console.WriteLine("Unexpected error: " & ex.Message)







               MonarchObj = Nothing

             End try

             End Sub




          Mo Abdolrahim