I have written a code for the same.
- private void btnColumnWrite_Click(object sender, EventArgs e)
- {
- string s = "";
- for (int i = 0; i < checkedListBox1.Items.Count; i++)
- {
- if(checkedListBox1.GetItemChecked(i))
- {
- s += checkedListBox1.Items[i] +",";
- }
- }
- StreamWriter SwriteData = new StreamWriter(@"C:\Users\user\Desktop\ReportTmplate\Test.txt");
- SwriteData.WriteLine("(" + s + ")");
- SwriteData.Close();
- }
When I execute this above code I got solution like wise : T1,T2,T3,T4,
But I want this like - T1,T2,T3,T4
I want to remove the last comma "," Symbol which is coming after T4 (Means last item selection), So please guide me on how to avoid this last ",".