ResetColor: The ResetColor subroutine changes the color scheme (both foreground and background) to the default. Many possible colors, like Red, are available on this enum. We assign the ForegroundColor and BackgroundColor properties.ĬonsoleColor: We must use the ConsoleColor enum to set colors. We can apply foreground (text) and background colors. Info: We see if the user typed "1" or "2" and pressed return. It tests the input after the return key is pressed. Here: This program repeatedly calls ReadLine. But we can also read lines, from the keyboard, with ReadLine. Writing is most common with the Console type. One overload of these methods receives the Object type.Īnd: When received, the subroutine will internally call the ToString method on the Object instance. You can pass any object to the Console.WriteLine and Console.Write subroutines. Tip: This is a clear way to form complex text outputs. Console.WriteLine("Dot Net Perls: are replaced in the output with the following arguments in the corresponding order. VB.NET program that uses Write, WriteLine In the Test1() sub, we use Console.WriteLine with an integer, a string literal, a Char array, a format pattern string, and with no arguments.Īlso: In the Test2() subroutine, we use the Console.Write sub in the same general ways. It is found in the System namespace in the. Tip: We don't need to import any namespaces to access the Console class. The Sub Main is the entry point of the program. The program is contained in a module named Module1. Numbers and strings are handled.Īn example. These programs, however, will readily accomplish an analytical or processing task. Easy to develop, it uses few resources and is efficient. It uses the Console.Write, WriteLine and ReadLine subs.Ĭonsole. This VB.NET article demonstrates the Console type. VB.NET Console.Write, WriteLine, ReadLine Examples