|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Is there a statement that will completely empty a listbox?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.?????? > GhostInAK wrote:
> Hello cj, I'm with you, Ghost! It takes too much effort to look something up - > > 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.?????? >> > > sometimes it even takes understanding what to look for. So much easier to just ask. T 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.?????? "The Grim Reaper" <grim_rea***@REMOVEbtopenworld.com> schrieb: LOL... Try 'Me.ListView1.Items.Clear()'.> It doesn't look like it, no. > > Use a listview instead - that's got a .Clear method... -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> 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/> "The Grim Reaper" <grim_rea***@REMOVEbtopenworld.com> schrieb: Well, the listbox control doesn't support column headers, so you do not need > 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. to clear them. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> ..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. > cj wrote:
> listview is new to me--don't know anything about it. Really? If you use Windows Explorer, then you use it probably everyday! 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! > 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. 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. > 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. >> > > 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.?????? |
|||||||||||||||||||||||