PC Review


Reply
Thread Tools Rate Thread

Clearing a listbox

 
 
wbntravis
Guest
Posts: n/a
 
      11th Sep 2008
I have a listbox loaded from addItem.
The listbox is on a userform.
There comes a moment in the program
when I want the listbox to unload what is in the listbox
and reuse the same listbox so I can add different items.
Is there a fast way to do that, without unloading the form?

Or is the a way to quickly clear a listbox contents
and repopulate it with other items?




--
wbnTravis, from Oklahoma
 
Reply With Quote
 
 
 
 
Corey
Guest
Posts: n/a
 
      11th Sep 2008
Listbox1.Clear

Corey.....
"wbntravis" <(E-Mail Removed)> wrote in message
newsD6963D5-2839-4BDB-B4F9-(E-Mail Removed)...
>I have a listbox loaded from addItem.
> The listbox is on a userform.
> There comes a moment in the program
> when I want the listbox to unload what is in the listbox
> and reuse the same listbox so I can add different items.
> Is there a fast way to do that, without unloading the form?
>
> Or is the a way to quickly clear a listbox contents
> and repopulate it with other items?
>
>
>
>
> --
> wbnTravis, from Oklahoma



 
Reply With Quote
 
IanC
Guest
Posts: n/a
 
      11th Sep 2008
From VB Help:

expression.RemoveItem(Index, Count)

expression An expression that returns a ControlFormat object.

Index Required Long. The number of the first item to be removed. Valid
values are from 1 to the number of items in the list (returned by the
ListCount property).

Count Optional Variant. The number of items to be removed, starting at
item Index. If this argument is omitted, one item is removed. If Index +
Count exceeds the number of items in the list, all items from Index through
the end of the list are removed without an error.


--
Ian
--
"wbntravis" <(E-Mail Removed)> wrote in message
newsD6963D5-2839-4BDB-B4F9-(E-Mail Removed)...
>I have a listbox loaded from addItem.
> The listbox is on a userform.
> There comes a moment in the program
> when I want the listbox to unload what is in the listbox
> and reuse the same listbox so I can add different items.
> Is there a fast way to do that, without unloading the form?
>
> Or is the a way to quickly clear a listbox contents
> and repopulate it with other items?
>
>
>
>
> --
> wbnTravis, from Oklahoma



 
Reply With Quote
 
wbntravis
Guest
Posts: n/a
 
      11th Sep 2008
Thanks IanC and Corey.... each gave me a different perspective

and I will use both where needed or where I want to experiment . : )

--
wbnTravis, from Oklahoma


"IanC" wrote:

> From VB Help:
>
> expression.RemoveItem(Index, Count)
>
> expression An expression that returns a ControlFormat object.
>
> Index Required Long. The number of the first item to be removed. Valid
> values are from 1 to the number of items in the list (returned by the
> ListCount property).
>
> Count Optional Variant. The number of items to be removed, starting at
> item Index. If this argument is omitted, one item is removed. If Index +
> Count exceeds the number of items in the list, all items from Index through
> the end of the list are removed without an error.
>
>
> --
> Ian
> --
> "wbntravis" <(E-Mail Removed)> wrote in message
> newsD6963D5-2839-4BDB-B4F9-(E-Mail Removed)...
> >I have a listbox loaded from addItem.
> > The listbox is on a userform.
> > There comes a moment in the program
> > when I want the listbox to unload what is in the listbox
> > and reuse the same listbox so I can add different items.
> > Is there a fast way to do that, without unloading the form?
> >
> > Or is the a way to quickly clear a listbox contents
> > and repopulate it with other items?
> >
> >
> >
> >
> > --
> > wbnTravis, from Oklahoma

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listbox not clearing Angel Blue01 Microsoft VB .NET 3 15th Aug 2007 11:30 PM
Clearing listbox =?Utf-8?B?15DXnNeZ?= Microsoft Excel Programming 3 24th Jul 2007 07:22 PM
Clearing A ListBox? Joe Delphi Microsoft Access 4 31st Jul 2005 09:41 PM
Problem clearing listbox Fred Thebeau Microsoft Access Forms 4 27th Feb 2004 02:26 PM
clearing a listbox =?Utf-8?B?YW1iZXI=?= Microsoft VB .NET 2 26th Feb 2004 11:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:07 PM.