newbie help with elearning sample console.writeline

  • Thread starter Thread starter mp
  • Start date Start date
M

mp

I'm working on some elearning courses from MS
i'm such a beginner i don't even know how to test the sample codes
create a new windows app, new console app, new class library?
lessons never tell a beginner the basic stuff - they always assume more
knowlege than i have
:-)

in this example it writes to the console
but when i run it, the dos prompt window flashes open and closes too fast to
read.
how to keep it open or where else to see the results of console.writeline
i don't see it in immediate window nor in output window.
even if i start a dosprompt before running this code the lines don't print
to that console, the other one still flashes open and closes immediately

here's the entire sample from elearning
Dim sFrame As StackFrame = New StackFrame(0, True)

' Display the flne name in execution

Console.WriteLine(" File: {0}", sFrame.GetFileName)



it doesn't say how to test it, but I started a new project in vb dotnet 2008
express - new console app

in module1.vb i pasted the code inside sub main

Module Module1

Sub Main()

Dim sFrame As StackFrame = New StackFrame(0, True)

' Display the flne name in execution

Console.WriteLine(" File: {0}", sFrame.GetFileName)



End Sub

End Module



then i hit debug-startdebugging

and the console window flashes (but it's behind the vis studio window - i
can see a corner of it only)



what am i missing?

thanks

mark
 
I'm working on some elearning courses from MS
i'm such a beginner i don't even know how to test the sample codes
create a new windows app, new console app, new class library?
lessons never tell a beginner the basic stuff - they always assume more
knowlege than i have
:-)

in this example it writes to the console
but when i run it, the dos prompt window flashes open and closes too fastto
read.
how to keep it open or where else to see the results of console.writeline
i don't see it in immediate window nor in output window.
even if i start a dosprompt before running this code the lines don't print
to that console, the other one still flashes open and closes immediately

here's the entire sample from elearning
Dim sFrame As StackFrame = New StackFrame(0, True)

' Display the flne name in execution

Console.WriteLine(" File: {0}", sFrame.GetFileName)

it doesn't say how to test it, but I started a new project in vb dotnet 2008
express - new console app

in module1.vb i pasted the code inside sub main

Module Module1

Sub Main()

Dim sFrame As StackFrame = New StackFrame(0, True)

' Display the flne name in execution

Console.WriteLine(" File: {0}", sFrame.GetFileName)

End Sub

End Module

then i hit debug-startdebugging

and the console window flashes (but it's behind the vis studio window - i
can see a corner of it only)

what am i missing?

thanks

mark

Just put "Console.ReadLine" just before "End Sub" of main sub.

HTH,

Onur Güzel
 
I'm working on some elearning courses from MS snip>
what am i missing?

thanks

mark

Just put "Console.ReadLine" just before "End Sub" of main sub.

HTH,

Onur Güzel

thanks, so if i see console.writeline in a sample it is correct i want to
start a new console app in order to see that activity? it wont' show in any
of the debug windows inside the vbnet experss ide, correct?
thanks
mark
 
Just put "Console.ReadLine" just before "End Sub" of main sub.

HTH,

Onur G zel

thanks, so if i see console.writeline in a sample it is correct i want to
start a new console app in order to see that activity?  it wont' show in any
of the debug windows inside the vbnet experss ide, correct?
thanks
mark

Couldn't understand what you meant. At runtime, you need
"Console.Readline" or "Console.Read" in order to pause the execution
until a user input arrives. Thus, you can see all the activity out
there on console window, and in IDE, using Immediate/Debug window, if
you call Debug.WriteLine rather than Console.WriteLine, you won't need
something like "Console.Read/Readline" to see what's going on, as all
the activity is recorded in Immediate window in Express editions.

HTH,

Onur Güzel
 
Just put "Console.ReadLine" just before "End Sub" of main sub.

HTH,

Onur G zel

thanks, so if i see console.writeline in a sample it is correct i want to
start a new console app in order to see that activity? it wont' show in
any
of the debug windows inside the vbnet experss ide, correct?
thanks
mark

Couldn't understand what you meant. At runtime, you need
"Console.Readline" or "Console.Read" in order to pause the execution
until a user input arrives. Thus, you can see all the activity out
there on console window, and in IDE, using Immediate/Debug window, if
you call Debug.WriteLine rather than Console.WriteLine, you won't need
something like "Console.Read/Readline" to see what's going on, as all
the activity is recorded in Immediate window in Express editions.

HTH,

Onur Güzel

thanks that clarifies it...
what i meant was
1
if i see console.writeline in a sample
in order to paste the sample code into a project to test it,
i start a new console app project as opposed to a new windows forms app or
new class library or other project types...
i guess in a console app there 's just one sub main and if i hit start
debugging button that runs the app
i guess i could also create a windows form app and put a command button on
the form to call sub main and that would also run the app?

2
output of console.writeline only goes to console window and not to any of
the builtin debug windows in the ide - you clarified that that is correct,
thanks
 
Back
Top