Results 1 to 19 of 19

Thread: Problems Reading a Text File with chr$ in VB6

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2005
    Posts
    44

    Problems Reading a Text File with chr$ in VB6

    Okay, I have a few files for the Betabrite Messaging Sign that you see at banks and whatnot. It has code in it, which without word wrap shows all on 1 line. So it could easily be a string in VB. However, it has chr$ codes in it, so it will stop reading partway through it.

    My file reading code is simple, so that may be why:

    VB Code:
    1. If Dir$(App.Path & "\out.txt") <> "" = True Then
    2.  
    3.   fnum = FreeFile
    4.   Open App.Path & "\out.txt" For Input As fnum
    5.     Input #fnum, livekey
    6.       Close fnum
    7.  
    8. End If
    9.  
    10.     Text1.Text = livekey
    Attached are 2 examples, out.txt being the more complicated one and out2.txt being a simple test.

    The question is: How do you get VB to read the entire string flawlessly? This string has to be repeated back flawlessly for the sign.

    The second question: VB doesn't like handling this real well because of the chr$ in it, so how can it be parsed out in something a bit more digestable? I was thinking I could convert it to VB friendly characters then reparse to send to the sign when need be, but the question does remain of how to initally get all the info.

    This is a fun one I have been fighting with for 3 days, so I say good luck and hope maybe someone out there can help with this!

    Chris
    Attached Files Attached Files

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