BUG: The ShowNetwork property of the PrintDialog cass does not display the Network button (814359)



The information in this article applies to:

  • Microsoft .NET Framework 1.1
  • Microsoft .NET Framework 1.0
  • the operating system: Microsoft Windows XP
  • the operating system: Microsoft Windows 2000
  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)
  • Microsoft Visual C# .NET (2003)
  • Microsoft Visual C# .NET (2002)

Beta Information

This article discusses a Beta release of a Microsoft product. The information in this article is provided as-is and is subject to change without notice.

No formal product support is available from Microsoft for this Beta product. For information about how to obtain support for a Beta release, see the documentation that is included with the Beta product files, or check the Web location where you downloaded the release.

SYMPTOMS

On Microsoft Windows 2000 operating system and later versions, when you use the PrintDialog class to print, the Network button is not visible. This occurs even if you set the ShowNetwork property to True. The Microsoft .NET Framework documentation indicates that the Network button is visible after you set the ShowNetwork property of the PrintDialog class to True. To view the .NET Framework documentation for the PrintDialog.ShowNetwork property, visit the following MSDN Web site:

PrintDialog.ShowNetwork Property
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwindowsformsprintdialogclassshownetworktopic.asp

CAUSE

This bug occurs because the Windows flag that corresponds to the ShowNetwork property (PD_NONETWORKBUTTON) is marked as obsolete. Therefore, the bug does not affect Windows 2000 and later versions.

RESOLUTION

To resolve this problem, display the Print dialog box by using Microsoft Common Dialog Control 6.0 instead of using the Microsoft .NET Framework PrintDialog class to display a dialog box with a Find Printer button. To do this, use the following code:

Microsoft Visual Basic .NET Code
Dim prnDlg As MSComDlg.CommonDialog
prnDlg = New MSComDlg.CommonDialog()
prnDlg.ShowPrinter()
Microsoft Visual C# .NET Code
MSComDlg.CommonDialog prnDlg;
prnDlg = new MSComDlg.CommonDialog();
prnDlg.ShowPrinter();
Note This article assumes that you have Microsoft Common Dialog Control 6.0 installed on your computer. Microsoft Common Dialog Control 6.0 does not come with Microsoft Visual Studio .NET.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

On Windows 2000 and later versions, the PrintDlg function is superseded by the PrintDlgEx function. PrintDlgEx displays a Print property sheet. The Print property sheet has a general page that contains controls similar to the Print dialog box. For more information about the PrintDlg function, visit the following MSDN Web site:

PrintDlg Function
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/userinput/commondialogboxlibrary/commondialogboxreference/commondialogboxfunctions/printdlg.asp

Steps to Reproduce the Behavior

  1. Open Microsoft Visual Studio .NET.
  2. Create a console application by using Visual Basic .NET or Visual C# .NET.
  3. On the Project menu, click Add Reference.
  4. On the .NET tab, double-click to select System.Drawing.dll, and then double-click to select System.Windows.Forms.dll.

    Assemblies are added to the Selected Components window.
  5. Click OK.
  6. Add the following code in the Main method:

    Visual Basic .NET Code
    Dim prnDlg As System.Windows.Forms.PrintDialog
    prnDlg = New System.Windows.Forms.PrintDialog()
    prnDlg.PrinterSettings = New System.Drawing.Printing.PrinterSettings()
    prnDlg.ShowNetwork = True
    prnDlg.ShowDialog()
    Visual C# .NET Code
    PrintDialog prnDlg;
    prnDlg = new PrintDialog();
    prnDlg.PrinterSettings =  new System.Drawing.Printing.PrinterSettings();
    prnDlg.ShowNetwork = true;
    prnDlg.ShowDialog();
  7. On the Debug menu, click Start Without Debugging to run the project.

REFERENCES

For more information, visit the following MSDN Web site:

PrintDialog Class
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWindowsFormsPrintDialogClassTopic.asp

Modification Type:MinorLast Reviewed:1/20/2006
Keywords:kbvs2005swept kbvs2005doesnotapply kbvs2002sp1sweep kbProperties kbprint kbWindowsForms kbCmnDlgPrint kbbug KB814359 kbAudDeveloper