Results 1 to 2 of 2

Thread: [2005] Read values from .txt file

  1. #1

    Thread Starter
    Addicted Member Alexandru_mbm's Avatar
    Join Date
    Jul 2007
    Location
    VBForums.com
    Posts
    157

    [2005] Read values from .txt file

    I have an RS232 text file read and stored to my hard drive.
    My problem is now about how can i take the values from the line 6, 7 and 8 and ignore the rest ?

    Can i define a "dictionary" of ignored (first 5 lines) and some strings (like "O2 % .... ") ?

    *** TELEGAN ***
    TEMPEST 100 V3.3
    DATE 10-03-08
    TIME 12:57:59
    NETT C -1
    O2 % .... 20.9
    XAIR O2 > 20%
    CO ppm ..... 0
    I'm still learning VB.NET
    Sorry for my bad english
    Thanks for your help

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Read values from .txt file

    Create a StreamReader and call ReadLine 5 times, then 3 more. Ignore the results of the first 5 reads and keep the next 3.

    - or -

    Call File.ReadAllLines to get the file contents into a String array, then get the elements at indexes 5, 6 and 7.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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