private void btnValidate_Click(object sender, EventArgs e) { ediDocument oEdiDoc = null; ediDataSegment oSegment = null; ediWarning oWarning = null; ediWarnings oWarnings = null; Int32 nWarningsCount; oEdiDoc = new ediDocument(); oEdiDoc.CursorType = DocumentCursorTypeConstants.Cursor_ForwardOnly; oEdiDoc.LoadSchema(txtSefFile.Text, SchemaTypeIDConstants.Schema_Standard_Exchange_Format); oEdiDoc.LoadEdi(txtEdiFile.Text); //iterate through each segment in the the EDI file so that they can be validated ediDataSegment.Set(ref oSegment, oEdiDoc.FirstDataSegment); while (oSegment != null) { ediDataSegment.Set(ref oSegment, oSegment.Next()); } //check if FREDI found any errors ediWarnings.Set(ref oWarnings, oEdiDoc.GetWarnings()); nWarningsCount = oWarnings.Count; //display errors for (int i = 1; i <= nWarningsCount; i++) { ediWarning.Set(ref oWarning, oWarnings.get_Warning(i)); lstBoxWarnings.Items.Add(oWarning.Description); } MessageBox.Show("Done"); }