Chapter 13. Using Dialog Boxes

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

graphics/icon18.gif

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:

  1. Start a new Windows Application project. Name it DialogBoxes.

  2. Click Form1.vb in the Solution Explorer, then change its File Name property in the Properties window to frmDialogBoxes.vb.

  3. Click the blank design area of Form1.vb to select it, then change its Name property in the Properties window to frmDialogBoxes.

  4. 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.

  5. 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    
    Top
     



    Special Edition Using Visual Basic. NET
    Special Edition Using Visual Basic.NET
    ISBN: 078972572X
    EAN: 2147483647
    Year: 2001
    Pages: 198

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net