Using a third party dll or using your own dll is a common scenario in software development. In this article, I will show you how to reference a dll in Mi-Form Scripting. Assume in your form scripting, you need to have some information that is configurable such as export directory, notification mail server, etc To make that information changeable, you can build a dll that reads an xml file that contains that information.

For example the xml will have the format below:


<?xml version="1.0" encoding="utf-8" ?>


Using visual studio to build a dll that can read the information from the xml file.


        /// <summary>
        /// read xmlFile and search for a key to get value
        /// </summary>
        /// <param name="xmlFile"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string ReadXMLByKey(string xmlFile, string key)
            string result = "";
                // Create an XML reader for this file.
                using (XmlReader reader = XmlReader.Create(xmlFile))
                    while (reader.Read())
                        // Only detect start elements.
                        if (reader.IsStartElement())
                            if (reader.Name == key)
                                result = reader.Value.Trim();

                return result;
            catch (Exception ex)
                throw ex;


Open scripting in Mi-Form Designer to add your dll.

Here how to use it:

Dim smtp as string =  MiCo.MiForms.Doyle.Utilities.ReadXMLByKey(xmlFilePath,"smtp")


Here just a very basic scenario where you can build your own dll and reference it from Mi-Form Scripting. Of course, you can have a lot more complicated cases where you need to interact with your back end system, web service call...