When I execute the code below, the "useThisEntityResult.SetValue(e.Result.ObjectId, 0);" line blows up and causes AutoCAD to abort.
Why??
I want to use the objectId from the Command prompt selection and pass it to an existing method that uses the ObjectId array.
{code}
static ObjectId[] useThisEntityResult = null;
private static void callback_promptEntityResult(object sender, PromptEntityResultEventArgs e)
{
MessageBox.Show("Starting callback:: promptEntityResult");
//Set up a reference to the AutoCAD editor
Autodesk.AutoCAD.EditorInput.Editor Ed = AcadApp.DocumentManager.MdiActiveDocument.Editor;
//Get the objectID of the selected object and place in the global var
useThisEntityResult.SetValue(e.Result.ObjectId, 0);
MessageBox.Show("Selection result: " + e.Result.ObjectId.ToString());
//Remove the event handler
Ed.PromptedForEntity -= new PromptEntityResultEventHandler(callback_promptEntityResult);
} //End Method callback_promptEntityResult
{code}