StringBuilder sb = new StringBuilder(); //Making columns! foreach (ColumnHeader ch in listView_Search.Columns) { sb.Append(ch.Text + ","); } sb.AppendLine(); //Looping through items and subitems foreach (ListViewItem lvi in listView_Search.SelectedItems) { foreach (ListViewItem.ListViewSubItem lvs in lvi.SubItems) { if (lvs.Text.Trim() == string.Empty) sb.Append(" ,"); else sb.Append(lvs.Text + ","); } sb.AppendLine(); } StreamWriter sw = new StreamWriter(filePath, false, Encoding.UTF8); sw.Write(sb); sw.Close();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)