• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

Aligning Forms on a Dot Matrix Printer

I want to be able to align a form on a dot matrix printer (Generic Text Printer Driver under Win95). Under VB DOS, this was possible (not sure how, but I'm upgrading an old application from VBDOS to VB6). The way this was done was to print one line and then get the user to confirm if it's printing in the right place. If not, print a second alignment line. If that doesn't work, print a third and final line, and then print the paycheques (It's a cheque printing program). So, Is it possible to do this with VB6 and if so, how? Needed by Monday at the latest.
0
bhlang
Asked:
bhlang
  • 3
  • 2
1 Solution
 
lehketCommented:
What you're talking about is called (or used to be, back in my mainframe days) a test pattern.  In VB you can do it something like this:


Dim iAnswer as Integer

Do
    PrintTestPattern
    iAnswer = (MsgBox "Print another test pattern?", vbYesNo)
Loop Until iAnswer = vbNo

------

Private Sub PrintTestPattern ()
    'Code to print line(s) used for page alignment
    Printer.EndDoc
End Sub

I believe (although I'm not entirely sure offhand) that you need the Printer.EndDoc to force the system to actually print out the page.  If you omit this line of code, I think what will happen is the print will be spooled but not printed until a later Printer.EndDoc is encountered or the program terminates.
0
 
lehketCommented:
Sorry, a typo crept in there.  That should have read:

    iAnswer = MsgBox ("Print another test pattern?", vbYesNo)

(The opening paren was misplaced.)
0
 
bhlangAuthor Commented:
Doesn't Printer.EndDoc force the printer to finish the page and spit it out thoush?
0
 
lehketCommented:
Yes, but that's what you need when you're printing a test pattern, generally speaking.  You're not going to start the "live" print on the same page as the test pattern ...
0
 
bhlangAuthor Commented:
Actually, I found the answer I needed in another question. Thanks for your help though. You get the points for trying to help.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now