Save CheckedListBox checked items

978 views Asked by At

How can I Save CheckedListBox (only) checked items with Savefiledialog?

If I use simple listbox then I use it:

   If SaveFileDialog1.ShowDialog() = DialogResult.OK Then
            Using writer = New StreamWriter(SaveFileDialog1.FileName)
                For Each o As Object In clb.Items
                    writer.WriteLine(o)
                Next
            End Using
        End If

But,now I want to use checkedlistbox.

1

There are 1 answers

1
Idle_Mind On BEST ANSWER

How can I Save CheckedListBox (only) checked items with Savefiledialog?

Change:

For Each o As Object In clb.Items

To:

For Each o As Object In clb.CheckedItems