//a button click call back event...
private void getEntity_Click(object sender, EventArgs e)
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
//this - is the modal dialog box.
using (EditorUserInteraction UI = ed.StartUserInteraction(this))
{
PromptEntityResult entResult = ed.GetEntity("\nSelect entity");
if (entResult.Status != PromptStatus.OK)
return;
using (Transaction Tx = db.TransactionManager.StartTransaction())
{
DBObject obj = Tx.GetObject(entResult.ObjectId, OpenMode.ForRead);
ed.WriteMessage(obj.GetType().Name);
Tx.Commit();
}
}
}