Microsoft KB Archive/814359

= BUG: The ShowNetwork property of the PrintDialog cass does not display the Network button =

Article ID: 814359

Article Last Modified on 5/11/2007

-

APPLIES TO


 * Microsoft .NET Framework 1.1
 * Microsoft .NET Framework 1.0
 * Microsoft Windows XP Professional
 * Microsoft Windows 2000 Standard Edition
 * Microsoft Visual Basic .NET 2003 Standard Edition
 * Microsoft Visual Basic .NET 2002 Standard Edition
 * Microsoft Visual C# .NET 2003 Standard Edition
 * Microsoft Visual C# .NET 2002 Standard Edition

-





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://msdn2.microsoft.com/en-us/library/system.windows.forms.printdialog.shownetwork(vs.71).aspx



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 &quot;Applies to&quot; 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://msdn2.microsoft.com/en-us/library/ms646940.aspx

Steps to Reproduce the Behavior
 Open Microsoft Visual Studio .NET. Create a console application by using Visual Basic .NET or Visual C# .NET. On the Project menu, click Add Reference. 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. Click OK.</li>  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; </li> On the Debug menu, click Start Without Debugging to run the project.</li></ol>

<div class="references_section">