From 728889a637a721810d2bc9e0a32e1aa1bf4f3271 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 26 Jan 2017 15:09:35 +0000 Subject: [PATCH] =?UTF-8?q?B2017-016=20=E2=80=93=20Handle=20when=20format?= =?UTF-8?q?=20selected=20from=20the=20dropdown=20happens=20to=20be=20the?= =?UTF-8?q?=20default=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frmSectionProperties.cs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/PROMS/VEPROMS User Interface/frmSectionProperties.cs b/PROMS/VEPROMS User Interface/frmSectionProperties.cs index 3493c02a..edc95e84 100644 --- a/PROMS/VEPROMS User Interface/frmSectionProperties.cs +++ b/PROMS/VEPROMS User Interface/frmSectionProperties.cs @@ -721,16 +721,19 @@ namespace VEPROMS return; } if (_InitialIndex < -1) _InitialIndex = ppCmbxFormat.SelectedIndex; // save the current format selection (happens here when current section format is not the default section) - PlantFormat pf = FormatInfoList.SortedFormatInfoList[ppCmbxFormat.SelectedIndex].PlantFormat; - // If the selected format does not have a docstyle compatable with the section - // then reset the format selection back to what it was - if (!ValidPlantFormat(pf)) + if (ppCmbxFormat.SelectedIndex > -1) // B2017-016 selectedindex of -1 means the default format was selected { - _Initializing = true; - ppCmbxFormat.SelectedIndex = _InitialIndex; // reset the format selection to what it was - ppBtnCancel.Focus(); // this will force the property page to refresh - _Initializing = false; - return; + PlantFormat pf = FormatInfoList.SortedFormatInfoList[ppCmbxFormat.SelectedIndex].PlantFormat; + // If the selected format does not have a docstyle compatable with the section + // then reset the format selection back to what it was + if (!ValidPlantFormat(pf)) + { + _Initializing = true; + ppCmbxFormat.SelectedIndex = _InitialIndex; // reset the format selection to what it was + ppBtnCancel.Focus(); // this will force the property page to refresh + _Initializing = false; + return; + } } if ((ppCmbxFormat.SelectedIndex != -1) && _DefaultFormatName != null && _DefaultFormatName.Equals(ppCmbxFormat.SelectedValue)) {