+ Reply to Thread
Results 1 to 3 of 3

Completely Erase ListBox

  1. #1
    Johnny
    Guest

    Completely Erase ListBox

    Hi all,

    This seems like a simple question, but I can't find the answer. I have
    a user form with a listbox control. I populate this control by setting
    the List property to a two-dimensional array. The listbox is populated
    based on the user's input into other controls. The same user form also
    has a reset button if the user wants to start over.

    In the click event of the reset button, I want to do something to
    completely clear the listbox of its contents. I've tried using the
    clear method, which throws "Unspecified Error". I've tried setting the
    List property to a blank two-dimensional array, which throws
    "Permission Denied". I've tried looping through the list and using the
    RemoveItem method, but that throws "Unspecified Error".

    I do have event handlers in the listbox on click event, but the call
    doesn't seem to be recursive (is that the right term?). Any ideas?

    Thanks,
    Johnny


  2. #2
    Jim Cone
    Guest

    Re: Completely Erase ListBox

    Johnny,

    If you have the RowSource specified in the properties window for
    the form you can run into that problem.
    If you are filling the list with an array then just remove the
    RowSource entry in the property window.
    Or if you must specify the RowSource, then to clear the list box
    just set the RowSource to an empty string...

    ListBox1.RowSource = vbNullString
    --
    Jim Cone
    San Francisco, USA
    http://www.realezsites.com/bus/primitivesoftware


    "Johnny" <[email protected]>
    wrote in message
    Hi all,
    This seems like a simple question, but I can't find the answer. I have
    a user form with a listbox control. I populate this control by setting
    the List property to a two-dimensional array. The listbox is populated
    based on the user's input into other controls. The same user form also
    has a reset button if the user wants to start over.

    In the click event of the reset button, I want to do something to
    completely clear the listbox of its contents. I've tried using the
    clear method, which throws "Unspecified Error". I've tried setting the
    List property to a blank two-dimensional array, which throws
    "Permission Denied". I've tried looping through the list and using the
    RemoveItem method, but that throws "Unspecified Error".

    I do have event handlers in the listbox on click event, but the call
    doesn't seem to be recursive (is that the right term?). Any ideas?

    Thanks,
    Johnny


  3. #3
    Johnny
    Guest

    Re: Completely Erase ListBox

    Jim,

    I've tried your suggestion and it does not work. I'm not using the
    rowsource property of the listbox. I'm setting the List property to an
    array.

    Thanks,
    Johnny


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1