How to call the console in a windows forms application

Harcon

Member
Joined
May 8, 2012
Messages
18
Programming Experience
1-3
Can any tell me how to get the console to work. When console.read is being run nothing happens.

VB.NET:
        Console.WriteLine(SL)
        Console.Read()
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,397
Location
Sydney, Australia
Programming Experience
10+
If it's a Windows Forms application then why would you want to use Console methods? Generally you'd only do that to output text to your Output window while debugging. Please provide a FULL and CLEAR description of what you're actually trying to achieve, not just how you're trying to achieve it.
 

Harcon

Member
Joined
May 8, 2012
Messages
18
Programming Experience
1-3
i want to use it as a debug screen to do a read out of settings in the application.
Because their are many options to controle, when i can open the console i read them out and easily find out the problem.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,397
Location
Sydney, Australia
Programming Experience
10+
Are you talking about while running the application in the debugger or a Release version?

If it's the former then, as I said, Console.WriteLine will write to the Output window. It's generally preferable to use Debug.WriteLine because that code can be left in and will simply be ignored by the compiler in a Release build but there can be times where Console.WriteLine is better.

If it's the latter then why not just create your own form with a single-line TextBox for input and a multi-line TextBox for output?

Regardless, I don't think that it's possible to display a console window for the same process in a WinForms app. You could start a new process and communicate with that via its standard input and output streams, but then it's not going to have access to the data in your app.
 
Top Bottom