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)) {