B2016-165 – Added function to get an item in list given an index

B2016-165 – fix crash on Section Properties when changing format and new format has less docstyles than newly selected format
This commit is contained in:
Kathy Ruffing 2016-07-13 13:05:42 +00:00
parent 0910a2deb5
commit 7bd76400c3
2 changed files with 11 additions and 1 deletions

View File

@ -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;
}

View File

@ -434,6 +434,16 @@ namespace VEPROMS.CSLA.Library
public class DocStyleList : vlnIndexedFormatList<DocStyle>
{
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