Sign in to follow this  
Followers 0
Marius

Troubles with reading a text file...

6 posts in this topic

#1 ·  Posted (edited)

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! :)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

$testcd = FileRead($file)

$testcd = ^ ERROR


Marius back in da hood! :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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! :)

Share this post


Link to post
Share on other sites

haven't done much with file operations yet.....(back to da' help file :) )


[u]Do more with pre-existing apps![/u]ANYGUIv2.8

Share this post


Link to post
Share on other sites
:)

Marius back in da hood! :)

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  
Followers 0