Jump to content

How to Clear ListBox and Put items back to another ListBox

Recommended Posts


Hi Guys, I have a problem hope someone can help me. Many thanks.

The Picture is the GUI of my auto-test. I want to clear all the items in the right Listbox via press Clear button. 

Part of Code



Func btnAdd()

     $rightmoveitem = GUICtrlRead($ListAvaiCom)
     If StringStripWS($rightmoveitem, 8) Then
            ConsoleWrite($rightmoveitem & @CRLF)
            GUICtrlSetData($ListChoCom, $rightmoveitem)
            $iSel = _GUICtrlListBox_GetCurSel($ListAvaiCom)
            _GUICtrlListBox_DeleteString($ListAvaiCom, $iSel)


Func btnRemove()

     $leftmoveitem = GUICtrlRead($ListChoCom)
     If StringStripWS($leftmoveitem, 8) Then
            ConsoleWrite($leftmoveitem & @CRLF)
            GUICtrlSetData($ListAvaiCom, $leftmoveitem)
            $iSel = _GUICtrlListBox_GetCurSel($ListChoCom)
           _GUICtrlListBox_DeleteString($ListChoCom, $iSel)


Func btnClear()




with this code I only can clear all the items of right listbox, but cannot put those items back to the left box.

below is the screenshot. Thank you very much.


Edited by Codartizan

Share this post

Link to post
Share on other sites

Please use the <> Code-Tag for posting scriptcode. Also a running (reproducer-) script is better than a picture. With scriptcode copy and paste is possible, without the helper must script a GUI. And as i think, there's no need that help willing people have more work as needed. 

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