Using .Peek in VB.net -- HELP!!

Discussion in 'OT Technology' started by Kingfisher, May 25, 2006.

  1. Kingfisher

    Kingfisher Keepin L's lit

    Joined:
    Mar 29, 2003
    Messages:
    4,736
    Likes Received:
    0
    Location:
    Southern California
    Ok, I am reading a text file of some records I have saved. Now I need to test for blank spaces I have used to seperate these records. For example:

    Record1
    Record1Data
    Record1Data
    Record1Data
    <---- This needs to be read as a separator.
    Record2
    Record2Data
    Record2Data
    Record2Data
    ---- <------ This needs to be read as the end of the file.

    * I have tried using: [code below] , but to no avail.

    If txtfile.Peek = "" Then
    'Code for the next record.
    Else
    'End of file.
    End If
     
  2. GOGZILLA

    GOGZILLA Double-Uranium Member

    Joined:
    Jan 16, 2003
    Messages:
    10,760
    Likes Received:
    3
    Location:
    Plantation, FL
    you need to read it as a carriage return character
     
  3. GOGZILLA

    GOGZILLA Double-Uranium Member

    Joined:
    Jan 16, 2003
    Messages:
    10,760
    Likes Received:
    3
    Location:
    Plantation, FL
  4. Yep

    Yep Knick knack paddy whack, give the old dog a bone

    Joined:
    Jan 22, 2001
    Messages:
    4,603
    Likes Received:
    0
    Location:
    South Jersey
    You need to look for 2 or more carriage returns (if what you typed resembles the data). Your code is also looking for a null character.
     
  5. motivez

    motivez New Member

    Joined:
    Sep 20, 2003
    Messages:
    5,808
    Likes Received:
    0
    Location:
    Greensboro, NC
    you aren't by chance doing an election program are you?
     
  6. Kingfisher

    Kingfisher Keepin L's lit

    Joined:
    Mar 29, 2003
    Messages:
    4,736
    Likes Received:
    0
    Location:
    Southern California
    No, not an election program. I figured it out. I did :

    If txtFile.peek = "13" then messagebox.show("End of first record.")

    How I figured that out what that I just did this (debug technique to find out what it was precisiely at that peek):
    Messagebox.show(txtFile.peek) and boom it spit out a "13". So there it goes....
     

Share This Page