UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

> Empty a Listbox    
 
   
jmbro10
post Dec 5 2007, 05:50 PM
Post #1

UtterAccess Member
Posts: 37



Hi, is there a quick way to clear a listbox w/value list? I see how to use removeitem on a selected item but how can I just quickly clear it?
Thanks!
Go to the top of the page
 
+
 
Start new topic
Replies (1 - 5)
Jack Cowley
post Dec 5 2007, 05:57 PM
Post #2

Retired Moderator
Posts: 37,716
From: The San Francisco Bay Area



Me.ListBoxName.RowSource = ""

I assume you want to remove the values and not just clear the selected items in the list box...

hth,
Jack
Go to the top of the page
 
+
accesshawaii
post Dec 5 2007, 05:59 PM
Post #3

UtterAccess VIP
Posts: 4,588
From: From Hawaii - Now in Wisconsin...Am I Nuts?



If you're trying to clear all the selections on a multi-select list box, you can do the following.

CODE
Dim x As Integer

'ABC Code
For x = 0 To MyListBox.ListCount - 1
    MyListBox.Selected(x) = False
Next x
Go to the top of the page
 
+
jmbro10
post Dec 5 2007, 06:01 PM
Post #4

UtterAccess Member
Posts: 37



Thanks so much! too simple!
Go to the top of the page
 
+
Jack Cowley
post Dec 5 2007, 06:05 PM
Post #5

Retired Moderator
Posts: 37,716
From: The San Francisco Bay Area



You are welcome.... I am NOT a fan of value lists, as I prefer to use tables. If, of course, you are building your list box on the fly then you approach may be more advantages...

Jack
Go to the top of the page
 
+
accesshawaii
post Dec 5 2007, 06:43 PM
Post #6

UtterAccess VIP
Posts: 4,588
From: From Hawaii - Now in Wisconsin...Am I Nuts?



You're welcome.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 20th May 2013 - 11:06 AM