CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Posts
    4

    open and read a txt file

    I have a text file with one line in it (I can also make it have one word) I need to write a VB program that will read this file every 5 seconds and based on the word inside (start or stop) execute a DDE connection. I can do the DDE part but I don’t know how to read the file, search for the word and execute the DDE commands based on the word and get it to run every 5 seconds. Any help would be great. Thanks


  2. #2
    Join Date
    Mar 2001
    Location
    Australia
    Posts
    146

    Re: open and read a txt file

    The following allows you to open a file:



    Dim FileNum as string
    Dim LineText as string

    FileNum = FreeFile
    Open FileName for input as FileNum

    If Not EOF(FileNum) then
    Line input #FileNum, LineText
    end if

    Close FileNum






    Hope this helps,

    Nathan Liebke


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

Featured