From 8a8818f1fb3d843c816ffbc5cac54ef70ef53d6c Mon Sep 17 00:00:00 2001 From: Rich Date: Wed, 10 Jun 2015 13:27:34 +0000 Subject: [PATCH] Added Error Handling for VETreeNode so that a disconnected TreeNode will not cause the code to crash. --- PROMS/VEPROMS.CSLA.Library/VEObjects/VETreeNode.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/VEObjects/VETreeNode.cs b/PROMS/VEPROMS.CSLA.Library/VEObjects/VETreeNode.cs index 2a8b15e7..c70a25cb 100644 --- a/PROMS/VEPROMS.CSLA.Library/VEObjects/VETreeNode.cs +++ b/PROMS/VEPROMS.CSLA.Library/VEObjects/VETreeNode.cs @@ -46,6 +46,7 @@ namespace VEPROMS.CSLA.Library public class VETreeNode : TreeNode { #region Events + private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public event VETreeNodeEvent LoadingChildrenSQL; public event VETreeNodeEvent LoadingChildrenMax; public event VETreeNodeEvent LoadingChildrenValue; @@ -207,11 +208,15 @@ namespace VEPROMS.CSLA.Library if (ol != null) { OnLoadingChildrenMax(this, new VETreeNodeEventArgs(ol.Count)); - this.TreeView.BeginUpdate(); + //this.TreeView.BeginUpdate(); + if (this.TreeView != null) this.TreeView.BeginUpdate(); + else _MyLog.WarnFormat("TreeView.BeginUpdate - Null"); ExpandChildren(ol); //} //tNext("Set Nodes"); - this.TreeView.EndUpdate(); + //this.TreeView.EndUpdate(); + if (this.TreeView != null) this.TreeView.EndUpdate(); + else _MyLog.WarnFormat("TreeView.EndUpdate - Null"); //tNext("End Update"); //tShowResults(); }