Visual Basic 2005 for Programmers (2nd Edition)
3.4. Displaying a Single Line of Text with Multiple Statements
The message Welcome to Visual Basic! can be displayed using multiple statements. Fig. 3.15 uses two method calls to produce the same output as the program in Fig. 3.1. Figure 3.15. Displaying a line of text with multiple statements.
Lines 89 of Fig. 3.15 display only one line of text in the Console window. The first statement calls Console method Write to display a string. Unlike WriteLine, Write does not position the output cursor at the beginning of the next line in the Console window after displaying its string. Instead, the next character displayed in the Console window appears immediately to the right of the last character displayed with Write. Thus, when line 9 executes, the first character displayed ("V") appears immediately after the last character displayed with Write (i.e., the space character after the word "to" in line 8). Each Write or WriteLine outputs its characters at the exact location where the previous Write's or WriteLine's output ended. |