473,473 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Is there a statement that will completely empty a listbox?

cj
listbox1.??????
Aug 10 '06 #1
14 1369
cj wrote:
listbox1.??????
\\\
Listbox1.Items.Clear()
///

--

(O)enone
Aug 10 '06 #2
It doesn't look like it, no.

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

"cj" <cj@nospam.nospamwrote in message
news:O3**************@TK2MSFTNGP03.phx.gbl...
listbox1.??????

Aug 10 '06 #3
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.??????

Aug 10 '06 #4
"The Grim Reaper" <gr*********@REMOVEbtopenworld.comschrieb:
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/>
Aug 10 '06 #5
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

"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
"The Grim Reaper" <gr*********@REMOVEbtopenworld.comschrieb:
>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/>

Aug 10 '06 #6
"The Grim Reaper" <gr*********@REMOVEbtopenworld.comschrieb:
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/>

Aug 10 '06 #7
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/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 11 '06 #8
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
Aug 11 '06 #9
Cj,

In addition to Oenone

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

I hope this helps,

Cor

"cj" <cj@nospam.nospamschreef in bericht
news:O3**************@TK2MSFTNGP03.phx.gbl...
listbox1.??????

Aug 11 '06 #10
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-****@online.microsoft.comschreef in bericht
news:5t**************@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/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Aug 11 '06 #11
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:
"The Grim Reaper" <gr*********@REMOVEbtopenworld.comschrieb:
>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.
Aug 11 '06 #12
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!

Aug 11 '06 #13
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:
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-****@online.microsoft.comschreef in bericht
news:5t**************@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/subscripti...ult.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/subscripti...t/default.aspx.
================================================= =

This posting is provided "AS IS" with no warranties, and confers no
rights.

Aug 11 '06 #14
cj
My comments are from a programming standpoint--AIYDK

Chris Dunaway wrote:
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!
Aug 11 '06 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chad Richardson | last post by:
I've always been mistified why you can't use a column alias in the group by clause (i.e. you have to re-iterate the entire expression in the group by clause after having already done it once in the...
7
by: Jean | last post by:
Hello, I have a form that performs a search, according to criteria that a user enters into the text boxes. When the user clicks on „Search", a SQL string (say strSQL) is built up with the...
10
by: Maksim Sipos | last post by:
Hello, I would like to have something like #ifdef VERSION_DEBUG #define DEBUG(x) DebugFnc(x) #end #ifdef VERSION_RELEASE #define DEBUG(x) <empty-statement> #end
12
by: Phoe6 | last post by:
The Program Fragment is this: int choice; /* Users Input Command */ .. .. .. printf("Enter a command: "); fflush(stdin); choice = getc(stdin); printf("\n");
3
by: Pafo007 | last post by:
Hi. I've built a small window, with some buttons and labels, and one listbox. During design time, I put five lines in the listbox and launch the program: the listbox appears empty! I can select...
6
by: Kun | last post by:
I am trying to make an if-statement that will not do anything and print 'nothing entered' if there is nothing entered in a form. I have the following code that does that, however, now even if I...
67
by: Rui Maciel | last post by:
I've been delving into finite state machines and at this time it seems that the best way to implement them is through an intense use of the goto statement. Yet, everyone plus their granmother is...
4
by: Dave | last post by:
I recently found out that the RequiredFieldValidator works differently for a ListBox than I needed; it checks to see if a row is selected, rather than checking to see if the listbox is empty. I...
3
by: sql2020 | last post by:
hi, i am fresh grad and wondering whether this idea can be done.. i have 1 ComboBox and 2 ListBox. ComboBox contain list of table, when user select a table, it will list the field name for...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.