3.8. Using a Message Dialog to Display a Message

The programs discussed thus far display output in the Console window. Visual Basic programs often use message dialog windows to display output. Visual Basic provides class MessageBox for creating message dialogs. We use a message dialog in Fig. 3.24 to display the square root of 2. For this program to compile and execute, you must perform several steps discussed later in this section. Be sure to read the entire section as you create this example.

Figure 3.24. Displaying text in a message dialog.
					1
					' Fig. 3.28: SquareRoot.vb
					2
					' Displaying the square root of 2 in a dialog.
					3
					4
					Imports System.Windows.Forms ' Namespace containing class MessageBox
					5
					6
					Module SquareRoot
 7
					8
					Sub Main()
 9
					10
					Dim root ...

Get Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.