function OpenWin(url, w, h) { if(!w) w = 400; if(!h) h = 300; window.open(url, "_new", "width=" + w + ",height=" + h + ",menubar=no,toobar=no,scrollbars=yes", true); } function Print() { window.focus(); if(window.print) { window.print(); window.setTimeout('window.close();',5000); } }
| Team-Fly | |
| Special Edition Using Microsoft® Visual Basic® .NET By Brian Siler, Jeff Spotts
| Table of Contents | | Part III: Building Windows Applications |
In this chapter Using Message Boxes to Keep the User Informed Using Input Boxes to Get Information from the User Using the Dialog Controls Creating Your Own Dialog Boxes From Here . . . A dialog box is a window used to display and/or accept information. Its name comes from the fact that it is, in essence, a dialog (or conversation) with the user. A dialog box is usually shown modally, which means the user must close it (or "answer the dialog") before continuing with any other part of the program. Visual Basic .NET makes it easier than ever to use dialog boxes in your applications. In this chapter, you'll look at two dialog boxes built in to Visual Basic .NET: the message box and the input box. Next, you'll learn about several Dialog controls that are provided through the CommonDialog class, which allow you to use different predefined types of standard Windows dialog boxes in your program. Finally, you'll review some guidelines for creating your own customized dialog box by developing a standard Windows form. As we work through this chapter, we will build a sample project that demonstrates the use of various dialog boxes. Note | You can download the complete sample project from this book's Web site at www.quepublishing.com. Look for the file named DialogBoxes.ZIP. |
Before we get into the details of dialog boxes, go ahead and set up the sample project that we will be using to demonstrate dialog box capabilities throughout this chapter. Perform the following steps: -
Start a new Windows Application project. Name it DialogBoxes. -
Click Form1.vb in the Solution Explorer, then change its File Name property in the Properties window to frmDialogBoxes.vb. -
Click the blank design area of Form1.vb to select it, then change its Name property in the Properties window to frmDialogBoxes. -
Right-click the DialogBoxes project in the Solution Explorer, then choose Properties from the pop-up menu. In the DialogBoxes Properties Pages dialog box, drop down the Startup object list and make sure frmDialogBoxes is selected as the project's Startup Object, then click OK to close the dialog box. -
Change the form's Text property to Dialog Box Demo. Save your work so far as we go on to begin our discussion of dialog boxes. |
| Team-Fly | |
|
| |
|