kalayaan Posted May 19, 2004 Share Posted May 19, 2004 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 . I see that ControlCommand can delete individual values but you'll have to know the number of occurences for it to work. Many thanks. Link to comment Share on other sites More sharing options...
midiaxe Posted May 19, 2004 Share Posted May 19, 2004 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 Link to comment Share on other sites More sharing options...
kalayaan Posted May 19, 2004 Author Share Posted May 19, 2004 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. Might be my mistake (most probable) . I guess I'll need to go over the code a few more times. Thanks very much. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now