Click here to Skip to main content
15,849,829 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

I have created a simple program in a console application and the result is printing correctly like

Name:abc...
Status:stable...

now i designed a windows form with a button and a text box.What i need is,when i click on the button the results in my console application should be displayed in the text box in the window form application.Is that possible?If yes..could you tell me how to do that?

thanks,
Posted

What you can do is start the console application from your WinForms code and redirect the standard output of the console to a stream you can read within the WinForms app.

Take a look at the code example here:

http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.useshellexecute.aspx[^]
 
Share this answer
 
Comments
BobJanova 2-Nov-11 7:38am    
5 for correct approach.
use Console.Out Link[^] property to send the output from console to a text file, then read the values from the text and show it on the textbox.
 
Share this answer
 
Comments
Menon Santosh 2-Nov-11 8:45am    
Nice Solution ;)
In addition to the responses you've already had, if you're wanting to combine Forms and Console then you may find my tip[^] useful. It does it the other way around (WinForm with Console attached) but if you read the comments you'll see it can be the other way too.
 
Share this answer
 
Hi,

In the Button click event u write the code like
var thevalue = 'ur object'
Textbox1.text = thevalue.tostring;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900