I'm trying to open up drawings from a list view. I close the dialog, and then try to open them. The drawing name gets passed, as I put in a message box to show this, but it keeps erroring out. I'm have looked and tried many things, and none seem to work. Any help is appreciated.
Here is the code I'm using.
void Button1Click(object sender, System.EventArgs e)
{
Close();
bool IsModel;
DocumentCollection DocCol = AcadApp.DocumentManager;
foreach (ListViewItem lvi in listView1.Items) {
ListViewItem.ListViewSubItemCollection lvsic = lvi.SubItems;
if (lvsic.Count > 1) {
try {
MessageBox.Show(lvsic[0].Text);
//Document tempDoc = DocCol.Open(lvsic[0].Text, true);
Document tempDoc = DocCol.Add(lvsic[0].Text);
if (string.Compare("Model", LayoutManager.Current.CurrentLayout) == 0) {
IsModel = true;
}
else IsModel = false;
StdScaleType ScaleType = (StdScaleType) Enum.Parse(typeof(StdScaleType), lvsic[4].Text, false);
MyPlottingPart(lvsic[1].Text, lvsic[2].Text, lvsic[3].Text, ScaleType, IsModel);
}
catch (System.Exception ex){
MessageBox.Show(ex.ToString());
}
}
}
}
Here are the picks of the two errors.