PageSetupDialog in Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This lesson describes the PageSetupDialog control


Visual Basic offers a wide range of dialog boxes that allow the user to make standard selections and each of them has a very specific purpose.
The purpose of the PageSetupDialog is specifying page set up for printing.

It displays a dialog box that lets the user specify properties for printed pages. For example, the user can specify the printer's paper tray, page size, margins, and orientation (portrait or landscape).

To display that dialog, this component calls its ShowDialog method, which returns DialogResult.OK if the user clicks OK, and DialogResult.Cancel if the user cancels.


    ' initialize the page settings
    PageSetupDialog1.PageSettings = New Printing.PageSettings

    ' hide the network button
    PageSetupDialog1.ShowNetwork = False

    If PageSetupDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
        Dim settings() As Object = New Object() _
        {PageSetupDialog1.PageSettings.Margins, _
         PageSetupDialog1.PageSettings.PaperSize, _
         PageSetupDialog1.PageSettings.Landscape, _
         PageSetupDialog1.PrinterSettings.PrinterName, _
        ' ToDo: something 
    End If

dialog box

Previous Lesson | Next Lesson

Share This

Home | About | Contact | Privacy Policy

Copyright 2018 - All Rights Reserved.