CheckedListBox.Items Read Only

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Corey Scheich

    CheckedListBox.Items Read Only

    Coming from mostly VBA to VB.NET so bare with me.

    I am creating a form with a CheckedListBox. I want to populate the listbox
    as the user types in a value. I tried to use

    CheckedListbox. Items = SomeCollection

    but I am getting a compile error saying that "Items" is a 'Read Only'
    Property. How should I get around this.

    Corey Scheich


  • Herfried K. Wagner [MVP]

    #2
    Re: CheckedListBox. Items Read Only

    * "Corey Scheich" <cERoNeouSschei ch@garlockequiP .com> scripsit:[color=blue]
    > I am creating a form with a CheckedListBox. I want to populate the listbox
    > as the user types in a value. I tried to use
    >
    > CheckedListbox. Items = SomeCollection[/color]

    \\\
    Dim Items As New ArrayList()
    Items.AddRange( New String() {"Foo", "Bar", "goo"})
    Me.CheckedListB ox1.Items.Clear ()
    Me.CheckedListB ox1.Items.AddRa nge(Items.ToArr ay())
    ///

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

    Comment

    • Corey Scheich

      #3
      Re: CheckedListBox. Items Read Only

      hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP]) wrote in message news:<ue67stdkE HA.3372@TK2MSFT NGP09.phx.gbl>. ..[color=blue]
      > * "Corey Scheich" <cERoNeouSschei ch@garlockequiP .com> scripsit:[color=green]
      > > I am creating a form with a CheckedListBox. I want to populate the listbox
      > > as the user types in a value. I tried to use
      > >
      > > CheckedListbox. Items = SomeCollection[/color]
      >
      > \\\
      > Dim Items As New ArrayList()
      > Items.AddRange( New String() {"Foo", "Bar", "goo"})
      > Me.CheckedListB ox1.Items.Clear ()
      > Me.CheckedListB ox1.Items.AddRa nge(Items.ToArr ay())
      > ///[/color]


      Worked great I appreciate it.

      Corey

      Comment

      Working...