Month: April 2017

Reading and Writing textfile with Encoding

To read and write textfiles, in Dynamics NAV, with special Encoding, you have to use the StreamReader or StreamWriter class, and the Encoding class from .NET. With this you don't need your OEM2ANSI conversion functions anymore. Note that XML Port has encoding built in, and File in the latest versions also offers some simple Encoding … Continue reading Reading and Writing textfile with Encoding

Execute external program from NAV using .NET

To run an external program from Dynamics NAV we need to use the System.Diagnostics.Process class. Create a variable of type DOTNET and select the System assembly and choose System.Diagnostics.Process. Use the following code to start the program. CLEAR(Process); Process := Process.Process(); Process.StartInfo.UseShellExecute := FALSE; Process.StartInfo.FileName := 'notepad.exe'; // path to program Process.StartInfo.Arguments := ''; // … Continue reading Execute external program from NAV using .NET