C # for application development with Milestones Professional

Question:     

Can I use C# for the application programming, instead of VB?

 

Answer:

Yes, but you need to use InvokeMethod for all the calls to Milestones. Milestones uses late binding.

Here is an example of some calls of using C# on a web server:

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

 

namespace Sample

{

      /// <summary>

      /// Summary description for WebForm1.

      /// </summary>

      public class WebForm1 : System.Web.UI.Page

      {

            private void Page_Load(object sender, System.EventArgs e)

            {

                  System.Type oType =System.Type.GetTypeFromProgID("Milestones");

                       

                  object o = System.Activator.CreateInstance(oType);

                 

                  oType.InvokeMember("Activate",System.Reflection.BindingFlags.InvokeMethod, null, o, new object[] {});

                  oType.InvokeMember("Use20Columns",System.Reflection.BindingFlags.InvokeMethod, null, o, new object[] {});

                  oType.InvokeMember("PutCell",System.Reflection.BindingFlags.InvokeMethod, null, o, new object[] {"1","3","From ASP.NET"});

oType.InvokeMember("SetDebugMode",System.Reflection.BindingFlags.InvokeMethod, null, o, new object[] {"On"});

                  oType.InvokeMember("SaveBitmap",System.Reflection.BindingFlags.InvokeMethod, null, o, new object[] {@"C:\inetpub\wwwroot\images\samplex.png"});

                  oType.InvokeMember("GetDebugText",System.Reflection.BindingFlags.InvokeMethod, null, o, new object[] {@"C:\inetpub\wwwroot\images\debugtext.txt"});

                 

                  oType.InvokeMember("Close",System.Reflection.BindingFlags.InvokeMethod, null, o, new object[] {});

 

oType = null;

                  o = null;

            }

 

            #region Web Form Designer generated code

            override protected void OnInit(EventArgs e)

            {

                  //

                  // CODEGEN: This call is required by the ASP.NET Web Form Designer.

                  //

                  InitializeComponent();

                  base.OnInit(e);

            }

           

            /// <summary>

            /// Required method for Designer support - do not modify

            /// the contents of this method with the code editor.

            /// </summary>

            private void InitializeComponent()

            {   

                  this.Load += new System.EventHandler(this.Page_Load);

            }

            #endregion

      }

}


 

Related topics

Automation interface to Milestones

Adjust task row height with automation

Automation method SetScheduleVerticalGridlines is not changing the grid lines

Licensing for automation

 

 

 

 

 

 

 

Applies to Milestones Professional:      2019        2021        2023        2025

 

 

 

 

      

The fast easy way to schedule your projects:  Milestones Software by KIDASA Software, Inc. www.kidasa.com

Copyright © 2025 KIDASA Software, Inc. All rights reserved.