I am creating concatenated strings based on the data in each row of my ListView control. I need to figure out how to remove the first element in each string which pertains to a single row of the ListView. How might I accomplish this? This is a C# winforms project.
Here is my current code:
foreach (ListViewItem HazPackErrItems in HazmatPackageErrorListview.Items) { string HazPackErrRow = ' '; foreach (ListViewItem.ListViewSubItem HazPackErrSub in HazPackErrItems.SubItems) { HazPackErrRow += ' ' + HazPackErrSub.Text + ','; } // Remove comma after last element of string. HazPackErrRow = HazPackErrRow.Substring(0, HazPackErrRow.Length - 2); MessageBox.Show(HazPackErrRow); // List concatenated subitems }
Just don’t add it in the first place?