Items NOT Checked - Hard question

In my attaced code my label is getting populated with items that have been checked in the RadList.

I need a second label to be populated with the items that WERE NOT checked.
Private Shared Sub getFIPS(ByVal listBox As RadListBox, ByVal label As Label)
        Dim sb As New StringBuilder()
        Dim collection As IList(Of RadListBoxItem) = listBox.CheckedItems
        For Each item As RadListBoxItem In collection
            sb.Append(item.Value & ",")
        Next
        label.Text = sb.ToString().Substring(0, sb.ToString().Length - 1)
    End Sub

Open in new window

Larry Bristersr. DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

13598Commented:
Loop through the items collection and check if checked = false.
0
13598Commented:
Or maybe you could used a derived class so you can use it like you use checkeditems.
Something like this:
public class CheckedListBoxEx:CheckedListBox  
    {  
        public CheckedListBoxEx(): base()              
        { }  
 
        public UncheckedItemCollection UncheckedItems  
        {  
            get  
            {  
                UncheckedItemCollection tmpColl = new UncheckedItemCollection();  
 
                for (int i = 0; i < base.Items.Count; i++)  
                {  
                    if (!base.GetItemChecked(i))  
                        tmpColl.Add(base.Items[i]);  
                }  
                return tmpColl;  
            }  
        }  
 
    }  
 
    public class UncheckedItemCollection:ObjectCollection  
    {  
        public UncheckedItemCollection()  
        { }      
    }  
 
    public class ObjectCollection : List<object>  
    { }  

0
13598Commented:
Derived class in vb.net:
Public Class CheckedListBoxEx
      Inherits CheckedListBox
            Public Sub New()
                  MyBase.New()
            End Sub

            Public ReadOnly Property UncheckedItems() As UncheckedItemCollection
                  Get
                        Dim tmpColl As New UncheckedItemCollection()

                        For i As Integer = 0 To MyBase.Items.Count - 1
                              If Not MyBase.GetItemChecked(i) Then
                                    tmpColl.Add(MyBase.Items(i))
                              End If
                        Next i
                        Return tmpColl
                  End Get
            End Property

End Class

      Public Class UncheckedItemCollection
            Inherits ObjectCollection
            Public Sub New()
            End Sub
      End Class

      Public Class ObjectCollection
            Inherits List(Of Object)
      End Class
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Larry Bristersr. DeveloperAuthor Commented:
13598:
This is not a checkbox list.  This is a Telerik RadList with checkboxes on
<telerik:RadListBox ID="RadListBox1" runat="server" CheckBoxes="true" Height="290px" Width="200px">
 </telerik:RadListBox>
0
13598Commented:
Can't you just loop through the items collection and check state It not checked use it?
0
Larry Bristersr. DeveloperAuthor Commented:
There doesn;t seem to be a Not Is checked method I can use...
0
13598Commented:
There is no checked property for the item?
0
13598Commented:
It would be something like:
 Dim collection As IList(Of RadListBoxItem) = listBox.items
        For Each item As RadListBoxItem In collection
if not item.checked then
            sb.Append(item.Value & ",")
end if.
        Next
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.