<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic VBscript C# in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/vbscript-c/m-p/10153380#M17219</link>
    <description>&lt;LI-CODE lang="csharp"&gt;        public double CalculFormula(string Formula)
        {

            MSScriptControl.ScriptControl sc = new MSScriptControl.ScriptControl();
            sc.Language = "VBScript";

            try
            {
                return System.Convert.ToDouble(sc.Eval(Formula));
            }
            catch (System.Exception)

            {
                return 0;
            }

        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private void button5_Click(object sender, EventArgs e)
{
lblsonuc.Text = CalculFormula(txtCalc.Text).ToString();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;This code works fine when compiled as WindowsForm. When I compile it as a plug-in (.dll), it does not find any errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but when triggered with the button I get this error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 13 Mar 2021 06:56:15 GMT</pubDate>
    <dc:creator>k005</dc:creator>
    <dc:date>2021-03-13T06:56:15Z</dc:date>
    <item>
      <title>VBscript C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/vbscript-c/m-p/10153380#M17219</link>
      <description>&lt;LI-CODE lang="csharp"&gt;        public double CalculFormula(string Formula)
        {

            MSScriptControl.ScriptControl sc = new MSScriptControl.ScriptControl();
            sc.Language = "VBScript";

            try
            {
                return System.Convert.ToDouble(sc.Eval(Formula));
            }
            catch (System.Exception)

            {
                return 0;
            }

        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private void button5_Click(object sender, EventArgs e)
{
lblsonuc.Text = CalculFormula(txtCalc.Text).ToString();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;This code works fine when compiled as WindowsForm. When I compile it as a plug-in (.dll), it does not find any errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but when triggered with the button I get this error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Mar 2021 06:56:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vbscript-c/m-p/10153380#M17219</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2021-03-13T06:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: VBscript C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/vbscript-c/m-p/10153854#M17220</link>
      <description>&lt;P&gt;As you have already known, as I replied in the other discussion forum, that Microsoft ScriptControl 1.0 is a 32-bit COM component. It being working in your .NET WinForm EXE is because your EXE is built against "any CPU" so that the .NET runtime automatically runs it as 32-bit app due to the fact the app uses a 32-bit component. If you rebuild your WinForm by targeting x64 CPU, you would have known it does not work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you post this in AutoCAD .NET discussion forum, I assume you are trying to run the code in AutoCAD plugin, where your AutoCAD is 64-bit. If so, you CANNOT use this 32-bit ScriptControl.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may want to search for different scripting component that is pure .NET component (thus run on both x86 or x64 platforms).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Mar 2021 14:13:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vbscript-c/m-p/10153854#M17220</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2021-03-13T14:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: VBscript C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/vbscript-c/m-p/10153873#M17221</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you. &lt;span class="lia-unicode-emoji" title=":pensive_face:"&gt;😔&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Mar 2021 14:29:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vbscript-c/m-p/10153873#M17221</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2021-03-13T14:29:49Z</dc:date>
    </item>
  </channel>
</rss>

