Jump to content

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
 
"word
is found"
 
instead of the desired
 
"word is found"
Local $aFindReplace
$aFindReplace = StringSplit(GUICtrlRead($findreplacelist), @LF)
_ArrayDisplay($aFindReplace)
For $x = 1 To UBound($aFindReplace) - 1
MsgBox($MB_SYSTEMMODAL, "", $aFindReplace[$x] & " is found")
Next
Edited by millisys
Link to comment
Share on other sites

?

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

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

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

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

While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
WEnd
Edited by mikell
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...