private void LoadFields() { if (segmentValue.Length > 2) { if (segmentValue.Substring(0, 3) == "MSH") { LoadMSHFields(); } else { fieldDelimiter = new Char[] { delimiters[2] }; String[] myFields = segmentValue.Split(fieldDelimiter); for (Int32 f = 0; f < myFields.Length; f++) { if (f == 0) { nameId = myFields[f]; } else { clsField newField = new clsField(myFields[f], delimiters, f); fields.Add(newField); } } } foreach (clsField f in fields) { f.OnFieldValueChanged += new EventHandler(FieldValueChanged); } } }
private void LoadMSHFields() { if (segmentValue.Length > 8) { nameId = segmentValue.Substring(0, 3); delimiters.Add(Convert.ToChar(segmentValue.Substring(3, 1))); fieldDelimiter = new Char[] { delimiters[2] }; for (Int32 i = 4; i < 8; i++) { delimiters.Add(Convert.ToChar(segmentValue.Substring(i, 1))); } clsField newField1 = new clsField(segmentValue.Substring(3, 1), delimiters, 1, false); fields.Add(newField1); String[] myFields = segmentValue.Substring(4).Split(fieldDelimiter); for (Int32 f = 0; f < myFields.Length; f++) { clsField newField; if (f == 0) { newField = new clsField(myFields[f], delimiters, f + 2, false); } else { newField = new clsField(myFields[f], delimiters, f + 2); } fields.Add(newField); } } }