Home All Groups Group Topic Archive Search About

Is there a statement that will completely empty a listbox?

Author
10 Aug 2006 8:37 PM
cj
listbox1.??????

Author
10 Aug 2006 9:46 PM
Oenone
cj wrote:
> listbox1.??????

\\\
    Listbox1.Items.Clear()
///

--

(O)enone
Author
10 Aug 2006 9:54 PM
GhostInAK
Hello cj,

You have GOT TO BE FREAKIN KIDDING ME!  Does no one install the help files?
Does no one look in the object browser?  Damn.

-Boo

Show quoteHide quote
> listbox1.??????
>
Author
11 Aug 2006 2:48 AM
tomb
GhostInAK wrote:

> Hello cj,
>
> You have GOT TO BE FREAKIN KIDDING ME!  Does no one install the help
> files? Does no one look in the object browser?  Damn.
>
> -Boo
>
>> listbox1.??????
>>
>
>
I'm with you, Ghost!  It takes too much effort to look something up -
sometimes it even takes understanding what to look for.  So much easier
to just ask.

T
Author
10 Aug 2006 9:56 PM
The Grim Reaper
It doesn't look like it, no.

Use a listview instead - that's got a .Clear method...
_________________________________________________________
The Grim Reaper

Show quoteHide quote
"cj" <cj@nospam.nospam> wrote in message
news:O39PbzLvGHA.1512@TK2MSFTNGP03.phx.gbl...
> listbox1.??????
Author
10 Aug 2006 10:02 PM
Herfried K. Wagner [MVP]
"The Grim Reaper" <grim_rea***@REMOVEbtopenworld.com> schrieb:
> It doesn't look like it, no.
>
> Use a listview instead - that's got a .Clear method...

LOL...  Try 'Me.ListView1.Items.Clear()'.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
10 Aug 2006 10:09 PM
The Grim Reaper
The OP said "completely empty".. I was going with the ListView1.Clear(),
which as you probably know clears the columns/headers as well as the items.
_________________________________________
The Grimy Raper

Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:%23d3WriMvGHA.4688@TK2MSFTNGP06.phx.gbl...
> "The Grim Reaper" <grim_rea***@REMOVEbtopenworld.com> schrieb:
>> It doesn't look like it, no.
>>
>> Use a listview instead - that's got a .Clear method...
>
> LOL...  Try 'Me.ListView1.Items.Clear()'.
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>
Author
10 Aug 2006 10:52 PM
Herfried K. Wagner [MVP]
"The Grim Reaper" <grim_rea***@REMOVEbtopenworld.com> schrieb:
> The OP said "completely empty".. I was going with the ListView1.Clear(),
> which as you probably know clears the columns/headers as well as the
> items.

Well, the listbox control doesn't support column headers, so you do not need
to clear them.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
11 Aug 2006 2:22 PM
cj
..items.clear

ok, I'd thought it was .clear but only saw clearselected.  I haven't
used listbox in years.

Thanks

listview is new to me--don't know anything about it.



Herfried K. Wagner [MVP] wrote:
Show quoteHide quote
> "The Grim Reaper" <grim_rea***@REMOVEbtopenworld.com> schrieb:
>> The OP said "completely empty".. I was going with the
>> ListView1.Clear(), which as you probably know clears the
>> columns/headers as well as the items.
>
> Well, the listbox control doesn't support column headers, so you do not
> need to clear them.
>
Author
11 Aug 2006 2:32 PM
Chris Dunaway
cj wrote:

> listview is new to me--don't know anything about it.

Really?  If you use Windows Explorer, then you use it probably every
day!
Author
11 Aug 2006 5:38 PM
cj
My comments are from a programming standpoint--AIYDK

Chris Dunaway wrote:
Show quoteHide quote
> cj wrote:
>
>> listview is new to me--don't know anything about it.
>
> Really?  If you use Windows Explorer, then you use it probably every
> day!
>
Author
11 Aug 2006 1:46 AM
Linda Liu [MSFT]
Hi Cj,

If you add items into ListBox by code, you could use the following
statement to completely empty a Listbox. The following is a sample code.

listBox1.Items.Clear();

If you set the DataSource property of the ListBox to a data source, you
could set the ListBox's DataSource property null to empty the ListBox.
Below is a sample code.

listBox1.DataSource = null;

Hope this helps.

If you have anything unclear, please feel free to let me know.


Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Author
11 Aug 2006 5:02 AM
Cor Ligthert [MVP]
Linda,

Almost correct, I had not seen your answer while I was answering the
followup message.

However please in VB code in this newsgroup. "null" can be confusing for VB
developers.

Therefore
listBox1.Items.Clear()
and
listBox1.DataSource = Nothing

What means

Cor

Show quoteHide quote
"Linda Liu [MSFT]" <v-l***@online.microsoft.com> schreef in bericht
news:5tfDNgOvGHA.5696@TK2MSFTNGXA01.phx.gbl...
> Hi Cj,
>
> If you add items into ListBox by code, you could use the following
> statement to completely empty a Listbox. The following is a sample code.
>
> listBox1.Items.Clear();
>
> If you set the DataSource property of the ListBox to a data source, you
> could set the ListBox's DataSource property null to empty the ListBox.
> Below is a sample code.
>
> listBox1.DataSource = null;
>
> Hope this helps.
>
> If you have anything unclear, please feel free to let me know.
>
>
> Sincerely,
> Linda Liu
> Microsoft Online Community Support
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> ications.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/default.aspx.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
Author
11 Aug 2006 2:27 PM
cj
Thanks Linda and Cor, I just needed .items.clear but I'll try to keep
the datasource=nothing in mind.


Cor Ligthert [MVP] wrote:
Show quoteHide quote
> Linda,
>
> Almost correct, I had not seen your answer while I was answering the
> followup message.
>
> However please in VB code in this newsgroup. "null" can be confusing for VB
> developers.
>
> Therefore
> listBox1.Items.Clear()
> and
> listBox1.DataSource = Nothing
>
> What means
>
> Cor
>
> "Linda Liu [MSFT]" <v-l***@online.microsoft.com> schreef in bericht
> news:5tfDNgOvGHA.5696@TK2MSFTNGXA01.phx.gbl...
>> Hi Cj,
>>
>> If you add items into ListBox by code, you could use the following
>> statement to completely empty a Listbox. The following is a sample code.
>>
>> listBox1.Items.Clear();
>>
>> If you set the DataSource property of the ListBox to a data source, you
>> could set the ListBox's DataSource property null to empty the ListBox.
>> Below is a sample code.
>>
>> listBox1.DataSource = null;
>>
>> Hope this helps.
>>
>> If you have anything unclear, please feel free to let me know.
>>
>>
>> Sincerely,
>> Linda Liu
>> Microsoft Online Community Support
>>
>> ==================================================
>> Get notification to my posts through email? Please refer to
>> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
>> ications.
>>
>> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
>> where an initial response from the community or a Microsoft Support
>> Engineer within 1 business day is acceptable. Please note that each follow
>> up response may take approximately 2 business days as the support
>> professional working with you may need further investigation to reach the
>> most efficient resolution. The offering is not appropriate for situations
>> that require urgent, real-time or phone-based interactions or complex
>> project analysis and dump analysis issues. Issues of this nature are best
>> handled working with a dedicated Microsoft Support Engineer by contacting
>> Microsoft Customer Support Services (CSS) at
>> http://msdn.microsoft.com/subscriptions/support/default.aspx.
>> ==================================================
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>
>
Author
11 Aug 2006 4:59 AM
Cor Ligthert [MVP]
Cj,

In addition to Oenone

In a binded listbox, set the datasource (or binding) to nothing

I hope this helps,

Cor

Show quoteHide quote
"cj" <cj@nospam.nospam> schreef in bericht
news:O39PbzLvGHA.1512@TK2MSFTNGP03.phx.gbl...
> listbox1.??????