diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index baaa4ea0..e7dbdc39 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -952,6 +952,7 @@ namespace Volian.Controls.Library // if already in edit mode, we don't want to do the StartEditing code below, because it // will override the current cursor positioning and selection range. Control ctrl = FindActiveControl(); + if (ctrl == null) return; // null if on property page for procedure & section number/title if (ctrl is VlnFlexGrid) { // Selected table cell is not in edit mode. Go into edit mode and position acording @@ -1004,7 +1005,8 @@ namespace Volian.Controls.Library StartGridEditing(SelectionOption.End); IDataObject myDO = Clipboard.GetDataObject(); RichTextBox myRtb = _MyStepRTB; - Control ctrl = FindActiveControl(); + Control ctrl = FindActiveControl(); // null if on property page for procedure & section number/title + if (ctrl == null) return; //Console.WriteLine("Paste myRTB == ctrl {0}", myRtb.Equals(ctrl)); if (!_MyStepRTB.Focused) { @@ -1064,7 +1066,12 @@ namespace Volian.Controls.Library bool beenThereDoneThat = false; // flag to prevent infinate loop Control tmp = this; while (!(tmp.Parent is Form)) + { tmp = tmp.Parent; + // if coming from property page (properties of procedure & section number/title), + // tmp becomes null rather than from flexgrid or steptext. + if (tmp == null) return null; + } Form frm = tmp.Parent as Form; tmp = frm.ActiveControl; while (!beenThereDoneThat && tmp.Controls.Count > 0) @@ -1088,6 +1095,7 @@ namespace Volian.Controls.Library private void MoveSelectedToClipboard(bool isCut) { Control ctrl = FindActiveControl(); + if (ctrl == null) return; // null if on property page for procedure & section number/title Clipboard.Clear(); DataObject myDO = new DataObject(); ; if (ctrl is RichTextBox)