Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I clear a listbox?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01155536
Message ID:
01155541
Views:
16
Thank you both! That was embarassingly easy! I don't know why I've never seen that Clear() method before.

Anyhow, thanks tons!

>>I have a listbox set as follows:
>>
>>.RowSourceType = 1
>>.RowSource = "accountant,programmer"
>>
>>
>>I allow the user to pop up a dialog where multiple items can be selected. The items that are shown in the listbox are initially selected. When the user is done selecting/deselecting items from the dialog box, the item list is returned as a comma separated string. This string is used to re-populate the listbox.
>>
>>The problem is when the user deselects all items in the dialog, the string returned is empty but the listbox won't "empty" its contents. In other words, when I replace .RowSource with "", it just leaves whatever was originally displayed.
>>
>>My code looks like this:
>>
>>do form frmMultiList with [Ministries],[Available Ministries],[minlook.ministry],m.newmin to m.newmin
>>
>>this.lstMinistries.RowSource = m.newmin
>>this.lstMinistries.Refresh
>>
>>
>>So, if the listbox is originally showing "accountant,programmer" and the user uses the dialog to return "secretary,painter" to m.newmin, then everything works great. The listbox shows secretary and painter in the list.
>>
>>But, if the user uses the dialog to return "" to m.newmin, the listbox continues to show "accountant,programmer".
>>
>>How do I get the listbox to display the empty value ... or no list?
>
>
>
>IF EMPTY(m.newmin)
>   this.lstMinistries.RowSource = []
>   this.lstMinistries.Clear()
>ELSE
>   this.lstMinistries.m.newmin
>ENDIF
>
Previous
Reply
Map
View

Click here to load this message in the networking platform