Jump to content

Do type values in the edit reading her a txt file?

Recommended Posts

#include <GUIConstants.au3>
$Form1 = GUICreate("Import File to Editbox", 633, 454, 193, 115)
$Edit1 = GUICtrlCreateEdit("", 8, 32, 617, 417)
$Button1 = GUICtrlCreateButton("Import File to Edit box", 160, 0, 305, 25, 0)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $Button1
            Local $sFile = FileOpenDialog("Import File", @ScriptDir, "All (*.*)")
            ImportToEdit($Edit1, $sFile)

Func ImportToEdit($Edit, $File)
    Local $sInfo = FileRead($File, FileGetSize($File))
    If @error Then Return
    GUICtrlSetData($Edit, $sInfo)

Try that, it will read a file and put the contents into a edit box. I put the actual code into a function so it's "portable".

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...