Microsoft KB Archive/257779

= FIX: Printer Dialog of DataReport PrintReport Method Always Shows Portrait =

Article ID: 257779

Article Last Modified on 8/7/2007

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q257779



SYMPTOMS
When using the PrintReport method of the DataReport object and passing True for the first parameter, the Printer dialog box always defaults to Portrait even if you set the printer's default orientation to Landscape in the Printers folder on Microsoft Windows.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in the latest service pack for Visual Studio 6.0.

For additional information about Visual Studio service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That a Visual Studio Service Pack Is Installed

To download the latest Visual Studio service pack, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/vstudio/Aa718353.aspx



Steps to Reproduce Behavior
 Change the default printer's default page orientation to Landscape in the Printers folder on Windows. Create a new Standard EXE project in Visual Basic. Form1 is created by default. Add a CommandButton control to Form1.  Paste the following code into Form1's code window: Private Sub Command1_Click DataReport1.PrintReport True End Sub  From the Project menu, select Add Data Environment to add DataEnvironment1 to the project. In DataEnvironment1, right-click Connection1, and then choose Properties. Set the Properties of Connection1 to be the following: <ul> On the Provider tab, set Provider to Microsoft Jet 4.0 OLE DB Provider.</li> Click Next.</li> On the Connection tab, set the database name to NWIND.MDB.</li> Click Test Connection to make sure you are connected to the database.</li> Click OK.</li></ul> </li> Right-click Connection1 and choose Add Command to add Command1.</li> Right-click Command1 and select Properties. Set the properties of Command1 to be the following: <ul> On the General tab, change the Database object to Table.</li> Drop down the Object Name combo box and select Employees.</li> Click OK.</li></ul> </li> From the Project menu, select Add Data Report. DataReport1 is added by default.</li> Set the properties of DataReport1 to be the following: <ul> Set the DataSource property to DataEnvironment1.</li> Set the DataMember property to Command1.</li> Set the ReportWidth property to 11520 (8 inches).</li> Set the LeftMargin property to 1440 (1 inch).</li> <li>Set the RightMargin property to 1440 (1 inch).</li></ul> </li> <li>If you add ReportWidth, LeftMargin, and RightMargin, the total report width is 10 inches, which is correct size for the Landscape orientation on standard letter size paper.</li> <li>Press the F5 key to run the program.</li> <li>Click the CommandButton that brings up the Printer dialog box. Note that the Page Orientation in the Printer dialog box is Portrait.</li></ol>

Additional query words: sp4

Keywords: kbbug kbdataenv kbfix kbreportwriter kbvs600sp4fix kbvs600sp5fix KB257779

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.