Sign in to follow this  
Followers 0
kalayaan

Clearing Listbox Contents

3 posts in this topic

Hi, is there a quick way to clear the contents of a listbox so that when you send new data to it, it is not just appended at the end. I tried both sending a null ("") value and pipe "|" as the help file said but that did not work :D . I see that ControlCommand can delete individual values but you'll have to know the number of occurences for it to work. :huh2:

Many thanks.

Share this post


Link to post
Share on other sites



Try GUISetControlData($lstItems, "") where $lstItems is the listbox control. This code works on machine.

Hope this helps!

=MX=

GUICreate("My GUI"); will create a dialog box that when displayed is centered

$cmdClear= GUISetControl("button", "Clear", 64,32,75,25)
GUISetControlNotify($cmdClear)
$lstItems= GUISetControl("list", "", 176,32,121,97)
GuiSetControlData($lstItems,"Line 1 |Line 2|Line 3")

$cmdClose = GUISetControl("button", "Close", 64,160,175,20)
GUISetControlNotify($cmdClose)

$n=0
While GUIMsg() > 0; will display a dialog box with 2 buttons
  $n=$n+1
  $t = GUIRead()
  Select
    Case $t = $cmdClear
      GUISetControlData($lstItems, "")
    Case $t = $cmdClose
      MsgBox(0,"", "the closing button has been clicked")
      Exit
  EndSelect
Wend

Share this post


Link to post
Share on other sites

MX, that's strange, I tried that in my home pc and it didn't work. But now that I try it at work, it does work. :huh2:

Might be my mistake (most probable) :D . I guess I'll need to go over the code a few more times.

Thanks very much.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0