From 7bd76400c3be243a024bc56a592613e220954d74 Mon Sep 17 00:00:00 2001 From: Kathy Date: Wed, 13 Jul 2016 13:05:42 +0000 Subject: [PATCH] =?UTF-8?q?B2016-165=20=E2=80=93=20Added=20function=20to?= =?UTF-8?q?=20get=20an=20item=20in=20list=20given=20an=20index=20B2016-165?= =?UTF-8?q?=20=E2=80=93=20fix=20crash=20on=20Section=20Properties=20when?= =?UTF-8?q?=20changing=20format=20and=20new=20format=20has=20less=20docsty?= =?UTF-8?q?les=20than=20newly=20selected=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PROMS/VEPROMS User Interface/frmSectionProperties.cs | 2 +- PROMS/VEPROMS.CSLA.Library/Format/DocStyles.cs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/PROMS/VEPROMS User Interface/frmSectionProperties.cs b/PROMS/VEPROMS User Interface/frmSectionProperties.cs index 371ada43..7f7e6859 100644 --- a/PROMS/VEPROMS User Interface/frmSectionProperties.cs +++ b/PROMS/VEPROMS User Interface/frmSectionProperties.cs @@ -610,7 +610,7 @@ namespace VEPROMS } if (oldSelIndx > newDocStyles.Count) { - string msg = string.Format("The section type that is set is not available in the new format, it was reset to {0}. Verify that it is appropriate.", newDocStyles[0].Name); + string msg = string.Format("The section type that is set is not available in the new format, it was reset to '{0}'. Verify that it is appropriate.", newDocStyles.GetDocStyleItem(0).Name); MessageBox.Show(msg, "Non-existent section"); selindx = 0; } diff --git a/PROMS/VEPROMS.CSLA.Library/Format/DocStyles.cs b/PROMS/VEPROMS.CSLA.Library/Format/DocStyles.cs index a5724e21..c27afd1c 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/DocStyles.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/DocStyles.cs @@ -434,6 +434,16 @@ namespace VEPROMS.CSLA.Library public class DocStyleList : vlnIndexedFormatList { public DocStyleList(XmlNodeList xmlNodeList) : base(xmlNodeList, null) { } + public DocStyle GetDocStyleItem(int itmcnt) // get the 'itm'th one from list, starting at '0' + { + int cnt = 0; + foreach (DocStyle ds in this) + { + if (cnt == itmcnt) return ds; + cnt++; + } + return null; + } } #endregion #region Layout