Jump to content
Sign in to follow this  

Create Array from Gui Edit control

Recommended Posts

Hi all,
I am trying to create an array from the contents of an Edit control. Using the code below, it creates the array just fine, but each of the items returned from the array contains an LF line feed after the value (except for the last one). I have tried using _GUICtrlEdit_GetText as well as different delimiters such as @CRLF and @CR but they add additional line returns either before or after as well. Thank you for your help :)
In the code below, the MsgBox will display
is found"
instead of the desired
"word is found"
Local $aFindReplace
$aFindReplace = StringSplit(GUICtrlRead($findreplacelist), @LF)
For $x = 1 To UBound($aFindReplace) - 1
MsgBox($MB_SYSTEMMODAL, "", $aFindReplace[$x] & " is found")
Edited by millisys

Share this post

Link to post
Share on other sites


#include <GUIConstantsEx.au3>
#Include <Array.au3>

GUICreate("My GUI edit") 
Local $idMyedit = GUICtrlCreateEdit("", 176, 32, 121, 97)

GUICtrlSetData($idMyedit, "First line" & @CRLF & "Second line" & @CRLF & "Third line" & @CRLF, 1)

Local $aFindReplace 
$aFindReplace = StringRegExp(GUICtrlRead($idMyedit), '.+', 3) 

While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
Edited by mikell

Share this post

Link to post
Share on other sites

Thank you so much mikell and Zedna, both of those techniques work great. Have a great weekend!

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.