Introduction
It's almost always more convenient to work with a windows GUI other than have to
use the DOS command prompt. It's easy to convert a DOS command line tool into a
Windows like application in C# by simply adding some Windows Forms tools
interacting with some code.
Here I take the RegenResx.exe as an example. I built a simple windows interface so that I could easily convert old version
resx files to be compatible with any version of the .NET framework. This
command line tool is very useful when upgrading older version resource
files. The tool itself can be found at RegenResx
Conversion Tool, or
Upgrading from the .NET Framework Beta Versions. I use the
System.Diagnostics
namespace and the
Process.Start
Method. This simple approach
could similarly be applied to run other command line tools, DOS commands, and other
windows applications. Some examples are also provided in the demo project.
The demo project is a windows form application. A TabControl
is put on a Windows
form. Each of the three tabs demonstrates a simple situation, either to run a
command line tool, a DOS command, or to run another windows application, such
as launch Internet Explorer with given address.
Code Sample
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Diagnostics;
...
System.Diagnostics.Process process1;
process1= new System.Diagnostics.Process();
process1.EnableRaisingEvents = false;
string strCmdLine;
strCmdLine = "/C regenresx "+textBox1.Text + " " +textBox2.Text;
System.Diagnostics.Process.Start("CMD.exe",strCmdLine);
process1.Close();
...
Summary
Take the command line tool RegenResx as an example, write the windows interface
to convert old version resx files to be compatible with any version of the .NET
framework. It's easy and fun to write simple useful application in C# using the
powerful .NET Framework.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.