I'm doing a windows form application. I want to get information from console. I found this code:
using System.Runtime.InteropServices;
using System;
[DllImport("kernel32.dll", SetLastError=true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool AllocConsole();
private void Form_Load(object sender, EventArgs e)
{
Console.WriteLine("Test");
}
Console is opening, but I couldn't see any output. I also tried System.Diagnostics.Debug.WriteLine(string message)
and System.Diagnostics.Trace.WriteLine(string message)
. What should I do?