Displaying Command Prompt on Windows Forms

Hi,
we currently have console application that has to be integrated into our newer Winforms application. The output should be displayed on the Windows Form. What is the simplest solution with the minimum amount of digging into the code?
Any ideas? Is there some kind of command prompt control where the command prompt window can be displayed?
Thanks.
quasar_eeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Paul_Harris_FusionCommented:
You could redirect the standard output from the process that runs your command line and post it on your form.

I think a bit of searding onr redirect stdout would turn up lots of examples
One such here...
http://www.devx.com/dotnet/Article/7914/0/page/5
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Paul_Harris_FusionCommented:
Sorry - example was vb.net but I;m sure you get the idea.....
0
käµfm³d 👽Commented:
You could launch the console application via System.Diagnostics.Process, redirect the output, then capture and display that output in a textbox. Here's a C# example:
System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();

info.FileName = @"C:\path\to\console\app.exe";
info.Arguments = "argumen1 argument2";
info.UseShellExecute = false;
info.RedirectStandardOutput = true;

System.Diagnostics.Process p = System.Diagnostics.Process.Start(info);
p.WaitForExit();

this.textBox1.Text = p.StandardOutput.ReadToEnd();

Open in new window

0
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

CodeCruiserCommented:
How about hosting the console in your winforms?

http://www.codeproject.com/KB/miscctrl/AppControl.aspx
0
käµfm³d 👽Commented:
How about hosting the console in your winforms?
For that approach, you'll have to change the call to WaitForInputIdle() to a Sleep() call (or some other mechanism which will give the process enough time to acquire its window handle). Console applications don't have a message pump like forms apps do, and WaitForInputIdle is dependent on a message pump.
0
Rose BabuSenior Team ManagerCommented:
Hi,

here is  a sample projects for command prompt custom cotrol.

this may help you.

http://www.codeproject.com/KB/miscctrl/commandprompt.aspx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.