Programming input and output with Visual Basic.NET
The Console
class in Visual Basic.NET allows a program to interact with a raw console for input and output. In the previous chapter, we utilized a project template for creating the Windows Forms app. This chapter will use the Console App project template to give us easy access to the Console
class. Console App projects can run on Microsoft Windows, Linux, and macOS operating systems.
For output, we can utilize the Write
and WriteLine
methods of the Console
class to output data to the screen. Here are some details to think about:
- The
Console.Write
andConsole.WriteLine
methods take a string parameter and send it to the console - The
Console.Write
method leaves the cursor at the end of the output so further output continues on the same line Console.WriteLine
sends the cursor to the following line
We can use the ReadLine
method of the Console
class to input data from the keyboard. Here are some details to think...