Console application question

C

Chris Leffer

Hi.

I am playing a bit with console applications. I have a very simple Main
routine to show some text on the console:

Module Module1

Public Sub Main()
Console.WriteLine("Hello world")
End Sub

End Module

When I run the project, the DOS window opens and close automatically. I
can only see the message if I set a breakpoint on the code. Is it
possible to keep the DOS window open without a breakpoint?

Regards,

Chris Leffer
 
H

Herfried K. Wagner [MVP]

Hello,

Chris Leffer said:
I am playing a bit with console applications. I have a very
simple Main routine to show some text on the console: [...]
When I run the project, the DOS window opens and close
automatically. I can only see the message if I set a breakpoint on
the code. Is it possible to keep the DOS window open without a
breakpoint?

Add a call to 'Console.Read'. Notice that the console is _not_ a DOS
window!
 
C

Carlos Barini

Hi Chris.
You have to go to command window (Is the execute textbox type "COMMAND" +
[Enter]),
browse to the sub directory where the .exe are, and execute the .exe using
command instruction, like

c:\My projects> Module1.exe [Enter]


regards

Carlos Barini
(e-mail address removed)
Brasil
 
C

Chris Leffer

Hi Herfried.

Your suggestion did the trick. And thanks for the clarification about
the console window :)

Could you tell me what Console.Read does exactly? It seems some kind of
wait state.

Regards,

Chris Leffer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top