with block for console input and output

mhpo

Newcomer
Joined
Feb 5, 2003
Messages
7
Hi,

I'm wondering, when I want to write and read a view times with / to console if there is not a possibility to shortening my VB code like this:

with system.console
.writeline("...")
myVar = .readline()
.writeline(...)
myVar2 = .readline()
end with

That doesn't function. What functions is to seperate the blocks for read and write:

With System.Console.In
myVar = .ReadLine()
End With

With System.Console.Out
.WriteLine("...")
End With

But that's not what makes my code effective. Is there another way to do it more elegant :confused:???

Thank you for all answers.
 
Just add Imports System.Console at the very top of the class
or module that your console code is in. Then you can just use ReadLine
and WriteLine by themselves with no Console.Anything.
 
Back
Top