just change the loop

Do While FileStream.Position < FileStream.Length
      if BinaryReader.ReadBoolean=True Then      

CheckedListBox1.Items.Add(BinaryReader.ReadString)
            CheckedListBox1.SetItemChecked(CheckedListBox1.Items.Count - 1, BinaryReader.ReadBoolean)
End If
        Loop

not compile D:

CheckedListBox1.Items.Clear()

        Dim FileStream As New System.IO.FileStream("e:\CheckedListBoxData.cld", IO.FileMode.Open)
        Dim BinaryReader As New System.IO.BinaryReader(FileStream)

        CheckedListBox1.BeginUpdate()
        Do While FileStream.Position < FileStream.Length
            If BinaryReader.ReadBoolean = True Then

                CheckedListBox1.Items.Add(BinaryReader.ReadString)
                CheckedListBox1.SetItemChecked(CheckedListBox1.Items.Count - 1, BinaryReader.ReadBoolean)
            End If
        Loop
        CheckedListBox1.EndUpdate()

        BinaryReader.Close()
        FileStream.Dispose()

hello gozo !
can you please rephrase your prob , there is not much time to read another thread to understand your prob , please give full description in order to get quick and good solutions of your prob.

simply i want is , checkedlistbox has 20 items 10 of them are checked i want when i click a button then its filter unchecked items and only show the checked items
i hop this will be a good description
thanks again :)

hello !
sorry for late reply , i know thread is solved , but here is a code to remove the unchecked items from checklistbox.

Dim i, ii, b As Integer
        Dim list, list2 As New ArrayList
        'in this loop we only select and add those items in our list those are checked
        For i = 0 To CheckedListBox1.CheckedItems.Count - 1
            list.Add(CheckedListBox1.CheckedItems.Item(i).ToString)
        Next
        'here we are adding items in list2 those are not in list , thats mean we are adding all the items those are not checked
        For ii = 0 To CheckedListBox1.Items.Count - 1
            Dim item As String
            item = CheckedListBox1.Items.Item(ii).ToString
            'this condition checks that is list contains the item , if return false then it will add it in list2
            If list.Contains(item.ToString) = False Then
                list2.Add(item.ToString)
            End If
        Next
        'here i am removing the items of list2 because they are unchecked 
        For b = 0 To list2.Count - 1
            CheckedListBox1.Items.Remove(list2.Item(b).ToString)
        Next

Regards

Comments
nice code , work perfectly .
This question has already been answered. Start a new discussion instead.