Sign Up Now! Log In
BenD 8/20/2012 3:32:15 PM

.NET Development - TextFieldParser

* This article, and all our great .NET Development documentation, Is available on the .NET Development menu

For a Dynamics developer, looping through a text file is a very common task. We're sent a file from some source and asked to import it into our company.

Today's task is to import a pipe delimited file into GL. The file looks (in part) like this:

00001|Current portion of Notes Pay. |01312012|123.000 |000-2900-00
00001|Current portion of Notes Pay. |01312012|-123.000 |000-2800-00
00002|Monthly Amortization Charge. |01212012|982.92000 |000-6300-00
00002|Monthly Amortization Charge. |01212012|-982.92000 |000-1610-00


We're going to make use of the TextFieldParser class to do the heavy lifting here. We'll cover a basic TextFieldParser example, and then get into a very nice piece of code that will save you tons of time.

Like all our code; we write these articles in order to save you development time. You'll find this one on the .NET Development menu under General.

Version: GP 9,GP 10,GP 2010
Section: eConnect,.NET Development