<?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 Re: &amp;lt;LispFunction.....Call VB.NET Function that use VB Forms? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/lt-lispfunction-call-vb-net-function-that-use-vb-forms/m-p/2850082#M62717</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can do the same things under the LipFunction attribute as under CommandMethod one.&lt;/P&gt;&lt;P&gt;The only difference is the lispFunction method must have an argument (a ResultBuffer) and should return a value: any LISP valid type : String ,Integer, Double, SelectionSet, ObjectId (ename) Point3d, TypedValue (T or nil) or a ResultBuffer contain these kind of values (as a LISP list). Except with A2008 which seems to only allows ResulBuffer as return type.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Dec 2010 16:18:03 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2010-12-10T16:18:03Z</dc:date>
    <item>
      <title>&lt;LispFunction.....Call VB.NET Function that use VB Forms?</title>
      <link>https://forums.autodesk.com/t5/net-forum/lt-lispfunction-call-vb-net-function-that-use-vb-forms/m-p/2849348#M62716</link>
      <description>&lt;P&gt;Can the LispFunction "feature"&amp;nbsp;be used to call other VB.NET Functions which load VB.NET forms?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2010 22:57:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/lt-lispfunction-call-vb-net-function-that-use-vb-forms/m-p/2849348#M62716</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-09T22:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: &lt;LispFunction.....Call VB.NET Function that use VB Forms?</title>
      <link>https://forums.autodesk.com/t5/net-forum/lt-lispfunction-call-vb-net-function-that-use-vb-forms/m-p/2850082#M62717</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can do the same things under the LipFunction attribute as under CommandMethod one.&lt;/P&gt;&lt;P&gt;The only difference is the lispFunction method must have an argument (a ResultBuffer) and should return a value: any LISP valid type : String ,Integer, Double, SelectionSet, ObjectId (ename) Point3d, TypedValue (T or nil) or a ResultBuffer contain these kind of values (as a LISP list). Except with A2008 which seems to only allows ResulBuffer as return type.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2010 16:18:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/lt-lispfunction-call-vb-net-function-that-use-vb-forms/m-p/2850082#M62717</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2010-12-10T16:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: &lt;LispFunction.....Call VB.NET Function that use VB Forms?</title>
      <link>https://forums.autodesk.com/t5/net-forum/lt-lispfunction-call-vb-net-function-that-use-vb-forms/m-p/2850100#M62718</link>
      <description>&lt;P&gt;Sure. Here is an example (in C#. it is simple enough to translate to VB.NET, or you can find an online C#&amp;lt;-&amp;gt;VB.NET converting site):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the Acad DLL project, add&amp;nbsp;Win form with c ouople of tex boxes to get user input:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using System;
using System.Text;
using System.Windows.Forms;

namespace LispInputFromForm
{
        public Form1()
        {
            InitializeComponent();
        }

        public string Text1
        {
	    get { return TextBox1.Text; }
        }

        public string Text2
        {
	    get { return TextBox2.Text; }
        }
}&lt;/PRE&gt;&lt;P&gt;The form would typically has 2 buttons: Cancel button with its DialogResult property set to "Cancel" and OK button with DialogResult property set to "OK". Of course you'd have user input validation logic in place before OK button can be clicked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you can use the form in a [ListFunction]-tagged function:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[LispFunction("Do_This")]
public static ResultBuffer GetLispData()
{
    ResultBuffer res = null;

    string t1="", t2="";
    bool cancelled = false;
    using (Form1 frm = new Form1())
    {
        DialogResult dlg = Autodesk.AutoCAD.ApplicationServices.
	                       Application.ShowModalDialog(frm);
        if (dlg == DialogResult.OK)
        {
                    t1 = frm.Text1;
                    t2 = frm.Text2;
        }
        else
        {
            cancelled = true;
        }
    }

    if (!cancelled)
    {
        TypedValue[] data=new TypedValue[]{
            new TypedValue((int)LispDataType.Text,t1),
            new TypedValue((int)LispDataType.Text,t2)
            };

        res = new ResultBuffer(data);
    }

    return res;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Natually, the form should be shown as Modal dialog so that the user must dismiss the form before the function can continue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2010 16:22:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/lt-lispfunction-call-vb-net-function-that-use-vb-forms/m-p/2850100#M62718</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2010-12-10T16:22:41Z</dc:date>
    </item>
  </channel>
</rss>

