VB Migration Partner

KNOWLEDGE BASE - Language


Previous | Index | Next 

[PRB] The FileLineInput6 statement uses CR-LF pairs as delimiters

The VB6 Line Input keyword reads a string from an open file until it finds either a CR-LF pair (ASCII 13 + ASCII 10) or a single CR (ASCII 13) character. The corresponding FileLineInput VB.NET function requires that each line be terminated with a CR-LF pair and ignores single CR characters.

VB Migration Partner converts Line Input statements into calls to the FileLineInput6 helper method (defined in CodeArchitects.VBLibrary.Dll), which in turn is based on VB.NET FileLineInput method and therefore inherits the abovementioned behavior.

As a result, if the file being read uses single CR characters as line delimiters, such a file can’t be read correctly from inside a migrated VB.NET project. There are a number of workarounds:

  1. First, if possible modify the structure of the text file to use CR-LF pairs as line separators. (This isn’t an option if the file is generated by another application.)

  2. If the file isn’t too large, use the File.ReadAllText method to read it in memory in one operation, then use the String.Split method to extract individual lines. The benefit of this technique is that the file read operation is faster.

  3. Define a method in your project named FileLineInput6 so that it overrides the method inside CodeArchitects.VBLibrary DLL. Such custom method should read from file one character at a time, and return a line as soon as a CR character is found.
Previous | Index | Next 




Follow Francesco Balena on VB6 migration’s group on

LinkedIn





Read Microsoft Corp’s official case study of a VB6 conversion using VB Migration Partner.




Code Architects and its partners offers remote and onsite migration services.

More details




Subscribe to our free newsletter for useful VB6 migration tips and techniques.

newsletter



To learn more about your VB6 applications, run VB6 Analyzer on your source code and send us the generated text file. You will receive a detailed report about your VB6 applications and how VB Migration Partner can help you to quickly and effectively migrate it to .NET.

Get free advice



A fully-working, time-limited Trial Edition of VB Migration Partner allows you to test it against your actual code

Get the Trial




The price of VB Migration Partner depends on the size of the VB6 application, the type of license, and other factors

Request a quote




Migrating a VB6 application in 10 easy steps

Comparing VB Migration Partner with Upgrade Wizard

Migration tools: Feature Comparison Table

All whitepapers