void addCardList() { CreateNewGroupDialog addDiag = new CreateNewGroupDialog(); if (cardListsTreeView.SelNode != null && ((MyTreeNode)cardListsTreeView.SelNode).Type == MyTreeNodeType.Collection) addDiag.SelectedCollectionID = ((MyTreeNode)cardListsTreeView.SelNode).ID; if (addDiag.ShowDialog() == DialogResult.OK) { LanguageData dataLayer = new LanguageData(); if (addDiag.GroupType == MyTreeNodeType.Collection) { //Add the collection, refresh the nodes, and select it dsLanguageData.CollectionRow collection = new dsLanguageData.CollectionDataTable().NewCollectionRow(); collection.Name = addDiag.GroupName; collection.CanEdit = true; dataLayer.InsertCollection(collection); ReLoadNodes(); foreach (MyTreeNode node in cardListsTreeView.Nodes) { if (node.ID == collection.ID) { cardListsTreeView.SelectNode(node, true); } } } else if (addDiag.GroupType == MyTreeNodeType.CardList) { //add the CardList, refresh the nodes, and select it dsLanguageData.CardListRow cardList = new dsLanguageData.CardListDataTable().NewCardListRow(); cardList.Name = addDiag.GroupName; cardList.CollectionID = addDiag.SelectedCollectionID; dataLayer.InsertCardList(cardList); ReLoadNodes(); foreach (MyTreeNode node in cardListsTreeView.Nodes) { if (node.ID == cardList.CollectionID) { node.Expand(); foreach (MyTreeNode cardListNode in node.Nodes) { if (cardListNode.ID == cardList.ID) { cardListsTreeView.SelectNode(cardListNode, true); } } } } //onDataSelected(); Removed 3/10/09 seems misplaced }//end elseif } }