Jump to content

Troubles with reading a text file...


Recommended Posts

Hello! :">

I need help here. My GUI just won't open and read test.txt file. I need it to read file and use it on combo.

$child = GUICreate("Pridėti naują usakymą", 300, 300, -1, -1, $WS_BORDER, -1, $1)
        $back2 = GUICtrlCreatePic ("newmark1.bmp", 0, 0, 300, 300)
        GuiCtrlSetState($back2, $GUI_DISABLE)
        GUISetState (@SW_SHOW)
        $naujascd = GUICtrlCreateCombo("", 10, 10, 275, 25)
        GUICtrlSetState($naujascd, $GUI_HIDE)
        GUICtrlSetState($naujascd, $GUI_SHOW)
        $end = GUICtrlCreateButton ("Baigti", 10,40 ,100, 25)
        FileOpen ( "test.txt", 0)
        $testcd = FileRead("test.txt")
        FileClose("test.txt")
        GUICtrlSetData($naujascd, $testcd)
        While 1
            $msg2 = GUIGetMsg()
            If $msg2 = $end Then
            GUISetState(@SW_HIDE)
             GUIDelete()
            ExitLoop
            EndIf    
        Wend
Edited by Marius
Marius back in da hood! :)
Link to comment
Share on other sites

Hello!  :">

I need help here. My GUI just won't open and read test.txt file. I need it to read file and use it on combo.

I get this error.

: ==> Incorrect number of parameters in function call.:

$child = GUICreate("Pridėti naują usakymą", 300, 300, -1, -1, $WS_BORDER, -1, $1)
        $back2 = GUICtrlCreatePic ("newmark1.bmp", 0, 0, 300, 300)
        GuiCtrlSetState($back2, $GUI_DISABLE)
        GUISetState (@SW_SHOW)
        $naujascd = GUICtrlCreateCombo("", 10, 10, 275, 25)
        GUICtrlSetState($naujascd, $GUI_HIDE)
        GUICtrlSetState($naujascd, $GUI_SHOW)
        $end = GUICtrlCreateButton ("Baigti", 10,40 ,100, 25)
        $file =FileOpen ( "test.txt", 0)
        $testcd = FileRead($file)
        FileClose($file)
        GUICtrlSetData($naujascd, $testcd)
        While 1
            $msg2 = GUIGetMsg()
            If $msg2 = $end Then
            GUISetState(@SW_HIDE)
             GUIDelete()
            ExitLoop
            EndIf    
        Wend

<{POST_SNAPBACK}>

try that..... Edited by quaizywabbit
[u]Do more with pre-existing apps![/u]ANYGUIv2.8
Link to comment
Share on other sites

Found solution:

;;;; ChildGUI
        $child = GUICreate("Pridėti naują usakymą", 300, 300, -1, -1, $WS_BORDER, -1, $1)
        $back2 = GUICtrlCreatePic ("newmark1.bmp", 0, 0, 300, 300)
        GuiCtrlSetState($back2, $GUI_DISABLE)
        GUISetState (@SW_SHOW)
        $naujascd = GUICtrlCreateCombo("", 10, 10, 275, 25)
        GUICtrlSetState($naujascd, $GUI_HIDE)
        GUICtrlSetState($naujascd, $GUI_SHOW)
        $lines = _FileCountLines($ftp)
        $newdata = FileReadLine($ftp, 1)
        GUICtrlSetData($naujascd, $newdata)
        For $i=2 To $lines
            $olddata = GUICtrlRead($naujascd)
            $newdata = FileReadLine($ftp, $i)
            GUICtrlSetData($naujascd, $olddata & $newdata)
        Next
        
        $end = GUICtrlCreateButton ("Baigti", 10,40 ,100, 25)
        While 1
            $msg2 = GUIGetMsg()
            If $msg2 = $end Then
            GUISetState(@SW_HIDE)
            GUIDelete()
            ExitLoop
            EndIf   
        Wend
Edited by Marius
Marius back in da hood! :)
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...