CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2002
    Location
    Croatia
    Posts
    275

    TextStream.WriteLine - NewLine problem

    Hallo
    I'm using VB scripting object to output some text to a file, something like this.

    Code:
    Dim fp as TextStream
    ...
    fp.WriteLine( "some text" )
    fp.WriteLine( "more text" )
    The problem appears on a different PC where my programm is installed. Generated text is written as one line in Notepad, with box-character instead of a NewLine.

    I have checked in HEX editor, and there is a difference in NewLine character that VB has added on the end of a WriteLine().

    On my PC, "some text" is followed with hex 0D 0A
    On another PC, "some text" is followed only with hex 0A.

    Any idea what's going on here?

  2. #2
    Join Date
    Jan 2003
    Location
    7,107 Islands
    Posts
    2,487

    Re: TextStream.WriteLine - NewLine problem

    have you tried something like this..?

    fp.Write "some text" & vbNewLine
    fp.Write "more text" & vbNewLine
    Busy

  3. #3
    Join Date
    Jan 2003
    Location
    7,107 Islands
    Posts
    2,487

    Re: TextStream.WriteLine - NewLine problem

    or might as well you may use the native vb file commands..

    Code:
    Dim nFile%
      
      nFile = FreeFile()
      Open "<filename>" For Output As #nFile
      
      Print #nFile, "some text"
      Print #nFile, "more text"
      
      Close #nFile
    Busy

  4. #4
    Join Date
    Mar 2002
    Location
    Croatia
    Posts
    275

    Re: TextStream.WriteLine - NewLine problem

    I prefer using Scripting object for writing, and I also had an idea to write an explicit NewLine to my string, but in mean time problem was solved and it was not software-related,

    Problem I was trying to solve were missing data during label printing. Since I have found a difference in text-output on my and another PC, I supposed that that caused the problem.
    But the solution was trivial: printer ribbon was partially not in place.

    Thanks for your answer anyway.
    regards

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