private void menuItem1_Click(object sender, System.EventArgs e) { if (this.lstSavedLocs.SelectedNode is ExpandedTreeNode) { frmLocEdit editForm = new frmLocEdit(); ExpandedTreeNode node = (ExpandedTreeNode)this.lstSavedLocs.SelectedNode; SavedLoc loc = (SavedLoc)node.AssociatedObject; editForm.editName = loc.Name; editForm.editX = loc.X.ToString(); editForm.editY = loc.Y.ToString(); editForm.editZ = loc.Z.ToString(); editForm.ShowDialog(); } LoadLocationsFromFile(); }