private void SaveLstToTxt(ListBox lst) { sfd.Filter = "(*.txt)|*.txt"; if (sfd.ShowDialog() == DialogResult.OK) { string sPath = sfd.FileName; FileStream fs = new FileStream(sPath, FileMode.Create); StreamWriter sw = new StreamWriter(fs, Encoding.UTF8); int iCount = lst.Items.Count - 1; for (int i = 0; i <= iCount; i++) { sw.WriteLine(lst.Items[i].ToString()); } sw.Flush(); sw.Close(); fs.Close(); } } //csharp/6994