Any experts on the ancient language of Visual Basic (VB6) on here?

Associate
Joined
26 Feb 2004
Posts
970
Location
China (Qinhuangdao)
Hi, Hopefully this is an easy one!

I've narrowed down a printing issue I have and have created a very small project to try to explain it.

I'm using the common dialog control to choose a printer.

I have a Command Button that shows the printers.
I have an Option Button that selects either Portrait of Landscape.
I have a label which displays the printer the user has chosen from the common dialog.

oJh4ry6.png

I have the following code:

Code:
Private Sub CmdPrint_Click()

    CDPrinter.ShowPrinter
    LblPrinter.Caption = Printer.DeviceName

End Sub

Private Sub Form_Load()

    LblPrinter.Caption = Printer.DeviceName

End Sub

Private Sub OptOrientation_Click(Index As Integer)

    If OptOrientation(0) = True Then Printer.Orientation = 1 Else Printer.Orientation = 2

End Sub

My problem:

When I run the program, as long as I don't change the orientation from portrait to landscape, I can choose another printer. However, as soon as I click on Landscape, I can no longer choose another printer.

I can't see what I'm doing wrong?

IIeYw8s.png

YETAWoC.png
 
Last edited:
Soldato
Joined
6 Mar 2008
Posts
10,078
Location
Stoke area
what happens if you change to landscape, then back to portrait and try to print?

Are you choosing the printer in your software or the common printer screen that pops up?

and why vb6?
 
Associate
OP
Joined
26 Feb 2004
Posts
970
Location
China (Qinhuangdao)
If I click landscape (or even change to landscape in software when the form loads) I then can only print to the printer that is displayed. I cannot change to another printer.

I'm choosing the printer in the common printer screen that pops up, I can select another printer and click print, but it won't change to the new printer.

All our software is written in VB6, has been since the early nineties. I know it's a dead language (except maybe VBA), but nobody here can write software in any other language.
 
Soldato
Joined
17 Jun 2012
Posts
11,259
Just rerun through the check printer sub after it's changed to landscape and visa versa. Create a seperate sub for check printer and invoke that sub when the cmd button is clicked.
 
Back
Top Bottom