How can i open console in C# graphical windows application and then write some data in 开发者_如何转开发console. Can i even open a console from win app?
Say you have a winform application in visual studio. Go to the Project Properties > Application Tab > Change "Output Type:" to Console Application.
Now when you launch your winform a console application will fire in the background. You can write to this console application with standard out. E.G.
private void button1_Click(object sender, EventArgs e)
{
Console.WriteLine("Hello World");
}
Check into Win32.AllocConsole()
Instructions here.
1st result for Google: c# write console
.
Incredibly, this is the least documented and most useful thing to do in C#.
精彩评论