Results 1 to 4 of 4

Thread: opening and reading from a txt file help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2004
    Posts
    28

    opening and reading from a txt file help

    bearing in mind i am a comple novice when it comes to programming (something i do apologise for as its bound to become extrmely annoying very quickly)

    how can i direct a push button to open and read a text file,
    and subsequently send each line of it to another program with a one second interval between each line send.

    i know of the microsfot.visuabasic.appactivate commands but i'm not sure how this would work with the above?

    and is it possible to get the program to pause and open a resume dialog box upon after sending a particular word. i.e it's sending the data recognises the word in question, send its and then brings up a resume button, you click the button and it carries on sending the infomation?

    as always you can get me on: -

    MSN: [email protected]
    AIM: Bobbafet41
    ICQ: 289141003

  2. #2
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    Reading a Text file

    I will address how to read a Text file.

    VB Code:
    1. Dim sr As System.IO.StreamReader = System.IO.File.OpenText(Application.StartupPath + "\text.txt")
    2.         Dim strFile As String = sr.ReadToEnd
    3.         sr.Close()
    4.         MsgBox(strFile)

    Cheers,
    McoreD
    Last edited by ~*McoreD*~; Jun 28th, 2004 at 07:00 PM.

  3. #3
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618
    If you are trying to send data between applications, I would look into .NET Remoting. But to be honest, if reading from a text file is giving you a hard time, Remoting is probably going to be way over your head.
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  4. #4
    Hyperactive Member dogfish227's Avatar
    Join Date
    Oct 2002
    Location
    GA
    Posts
    409
    and for the "every one secound part" put a timer control on the form and set the interval to 1000.

    but Sean is right reading/writing files is one of the easyer things to do in programing, and although i have no experience in sending data between apps i imagin it is fairly complicated.

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