Results 1 to 2 of 2

Thread: Help

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 1999
    Posts
    36
    I have this statement:

    Open App.Path + "\Notepad.txt" For Input As #1

    Input #1, Text1.Text

    Close #1

    Every time I run it, it tells me that:
    Variable is Required, can not assign to this expression
    And it highlights Text1.Text
    what does that mean?
    its really annoying
    its not working
    HELP!
    -Boo

  2. #2
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    The problem is that the Input statement does not allow any extra work to be done in its procedure, this includes reading a property of a control. Do the following to amend your problem:
    Code:
    Dim sData As String
    Dim iFileNum As Integer
    
    iFileNum = FreeFile
    Open App.Path & "\Notepad.txt" For Input Access Read Shared As #iFileNum
    Input #iFileNum, sData
    Close #iFileNum
    Text1.Text = sData
    It will work that way now, however, use the following for a better and more efficient results:
    Code:
    Dim iFileNum As Integer
    
    iFileNum = FreeFile
    Open App.Path & "\Notepad.txt" For Input Access Read Shared As #iFileNum
    Text1.Text = Input(LOF(iFileNum), #iFileNum)
    Close #iFileNum
    Later.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width