0 Replies Latest reply: May 15, 2014 10:14 AM by jx1000 _ RSS

    C Sharp Sample Code

    jx1000 _

      This forum has helped me out like a million times over the last ten years so I hope I can return the favor!

       

      Here's some sample C# code using the dynamic keyword. You have to be using C# 4.0 or higher for this code to work. Unfortunately when using the dynamic keyword the intellisense won't work but the properties and methods translate almost exactly from VB!

       

      dynamic Monarch = Activator.CreateInstance(Type.GetTypeFromProgID("Monarch32"));

       

      Monarch.Visible = true;

      bool openfile = Monarch.OpenDatabase("ODBC;DSN=YourConnectionName;", "", "YourTableName", "C:
      Program Files
      Monarch
      Models
      YourModelName.xmod");

      Monarch.CurrentSummary = "Test";

      Monarch.JetExportSummary ("C:
      My Documents
      Test.csv", "", 0);

      Monarch.CloseAllDocuments();

      Monarch.Exit();[/CODE]