Sure. Here is an example (in C#. it is simple enough to translate to VB.NET, or you can find an online C#<->VB.NET converting site):
In the Acad DLL project, add Win form with c ouople of tex boxes to get user input:
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; }
}
}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.
Then you can use the form in a [ListFunction]-tagged function:
[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;
} Natually, the form should be shown as Modal dialog so that the user must dismiss the form before the function can continue.