kalayaan 0 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. Share this post Link to post Share on other sites
midiaxe 0 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 Share this post Link to post Share on other sites
kalayaan 0 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. Share this post Link to post Share on other sites