Results 1 to 24 of 24

Thread: how do print in vb 6.0

  1. #1

    Thread Starter
    Banned
    Join Date
    Mar 2005
    Posts
    26

    how do print in vb 6.0

    Hi
    Need to print in vb 6.0

  2. #2
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512

    Re: how do print in vb 6.0

    You need to look at the 'printer' object for methods and properties

    printer.enddoc has to be called after you have done all your 'printing' to actually send everything to the printer.
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

  3. #3
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Manila, Philippines
    Posts
    486

    Re: how do print in vb 6.0

    ei one thing, do you want to print the form or you want to print records from database?

  4. #4
    Lively Member
    Join Date
    Sep 2004
    Location
    india
    Posts
    88

    Angry Re: how do print in vb 6.0

    do you want print simple form with text only? or form with lines and circles or graphics?
    can any one help which is the best way to print in above cases?

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: how do print in vb 6.0

    VB Code:
    1. Printer.print "This is a test"
    2. Printer.EndDoc

    Thats all there is to it!

  6. #6
    Fanatic Member bob5731's Avatar
    Join Date
    Nov 2004
    Posts
    918

    Re: how do print in vb 6.0

    PRINTER.PRINT
    print "bob"
    print "cox"
    print "ok"
    print
    print "dos"
    print "god"
    PRINTER.ENDDOC
    Last edited by bob5731; Mar 16th, 2005 at 05:01 AM.
    P.S. God Love You And Have A Good Day!!!My web page

    I need to get a free Iphone

  7. #7
    Hyperactive Member boku's Avatar
    Join Date
    Dec 2004
    Posts
    386

    Re: how do print in vb 6.0

    For some wierd reason, even if i use

    VB Code:
    1. printer.enddoc

    It still wont print the text until my program ends :s
    -BoKu-

  8. #8
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: how do print in vb 6.0

    That is odd. As soon as I send EndDoc, the queue starts filling up.
    How about in the IDE? Does it print immediately?

  9. #9
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: how do print in vb 6.0

    Quote Originally Posted by boku
    For some wierd reason, even if i use

    VB Code:
    1. printer.enddoc

    It still wont print the text until my program ends :s
    Change your code to this and tell us what happens.

    VB Code:
    1. MsgBox "About to ENDDOC"
    2. Printer.EndDoc
    3. MsgBox "Just did the ENDDOC"

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  10. #10
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: how do print in vb 6.0

    Quote Originally Posted by dos5731
    Hi
    Need to print in vb 6.0
    You can get stuff out using what others have posted, but if you are looking for formal, stylized reports, you would need to incorporate a report engine into your project. The best 'free' type of report generator would be creating your reports in Access and calling them from your VB code. If you are working with a budget, then look into something like Report Writer or Crystal Reports.

  11. #11
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Re: how do print in vb 6.0

    Or On a budget of zero pounds. Invest some time with this little baby....

    http://www.qbdsoftware.co.uk/moth/qp...qprinter20.htm

    Not too shabby.
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  12. #12
    Junior Member
    Join Date
    Oct 2004
    Location
    world
    Posts
    19

    Re: how do print in vb 6.0

    don't forget
    printer.currentx
    printer.currenty
    printer.print ""
    printer.enddoc

  13. #13
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: how do print in vb 6.0

    Quote Originally Posted by David.Poundall
    Or On a budget of zero pounds. Invest some time with this little baby....

    http://www.qbdsoftware.co.uk/moth/qp...qprinter20.htm

    Not too shabby.
    I'd never heard of the "DonationWare" qPrinter product. This looks interesting...thanks for the link.
    Last edited by Hack; Mar 16th, 2005 at 08:45 AM.

  14. #14
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Re: how do print in vb 6.0

    I used the earlier version on a commercial app and it was superb for doing reports. It comes with a handy print preview function a sstandard.

    Edward Moth has rewritten the program from the ground up and now it enjoys easier table creation. I have yet to use this new version but I am looking forward to it as the template function looks a lote easier than before. The documantation is also very well put together.
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  15. #15
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Re: how do print in vb 6.0

    Another print dll I have come across in the past, and tested, is this one.

    CSPrintengine

    I briefly considered it but decided at the end of the day to go with the one I knew more about. It looks a lot easier to use than qPrinter and the full version only costs $5.
    Last edited by David.Poundall; Mar 16th, 2005 at 09:57 AM.
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  16. #16
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: how do print in vb 6.0

    Quote Originally Posted by David.Poundall
    Another print dll I have come across in the past, and tested, is this one.

    CSPrintengine

    I briefly considered it but decided at the end of the day to go with the one I knew more about. It looks a lot easier to use than qPrinter and the full version only costs $5.
    When I tried this link, I got a "Page Could Not Be Displayed"

  17. #17
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: how do print in vb 6.0

    When I tried this link, I got a "Page Could Not Be Displayed"
    http://www.consiliumsoft.com/
    Rob C

  18. #18
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: how do print in vb 6.0

    We found Crystal to be too cumbersome and too limited in ability.

    We choose to develop our own report writer engine - it's actually a very simple task. We store "print objects" in a SQL table and loop through our data recordset and loop through the "print objects" and user .CURRENTX and .CURRENTY to produce extremely high quality reports.

    Whenever a new twist comes down the pike, we simply enhance our report writer engine - it's extremely simple.

    Last twist was to print the PO # on a purchase order vertically down the right side.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  19. #19
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Re: how do print in vb 6.0

    Sorry Guys I fixed the link - as I had saved it to hard disk it was referencing my E-Drive. It's OK now - here it the correct link as I am here.

    http://www.topshareware.com/CSPrinti...load-11486.htm

    Hi szlamany. Do you use a rich text box or a PictureBox for your reports. In either case how do you handle page breaks and word wrap?
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  20. #20
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: how do print in vb 6.0

    Quote Originally Posted by David.Poundall
    Hi szlamany. Do you use a rich text box or a PictureBox for your reports. In either case how do you handle page breaks and word wrap?
    We output directly to the PRINTER object.

    We have options to output also to a PICTURE BOX - but for the most part we ignore print-preview and have our users install FULL ADOBE, so they get the PDF print driver.

    We make extensive use of .TEXTWIDTH to measure items - so we can "right-fill" our numeric values - so decimal places line up.

    We always print with ";" at the end of the line, so we are fully in control of the vertical movement down a page.

    It's so nice to be able to do things like: Print the ADDRESS on the bottom of the check first, then go back up to the top to output the stub info; Print multi-column reports; Print quandrant type output (student transcripts); handle all the extremely odd total/break conditions that financial systems can throw at you.

    Here's a list of the "print objects" we support - plus there are lots of variations on these as well.

    Code:
        ' 1     Font
        ' 2     Fontsize
        ' 3     FontBold=True
        ' 4     FontBold=False
        ' 5     FontItalic=True
        ' 6     FontItalic=False
        ' 7     Forecolor
        ' 10    Portrait
        ' 11    Landscape
        ' 12    Duplex (horizontal)
        ' 13    Paperpin
        ' 14    Papersize
        ' 20    Skip to line
        ' 21    Skip to next line
        ' 22    Header Control
        ' 23    Skip to right
        ' 24    Eject page
        ' 25    Break column
        ' 26    Specific column
        ' 27    Skip back to prior line
        ' 30    Date
        ' 31    Draw line
        ' 32    Draw left/right edge lines
        ' 33    Page
        ' 34    Query line
        ' 35    JPG
        ' 40    Item with CR
        ' 41    Item without CR
        ' 50    Column with CR
        ' 51    Column without CR
        ' 52    Column (first-name-first) with CR
        ' 53    Column (if-not-blank) with CR
        ' 54    Column (numeric) with CR
        ' 55    Column (numeric) without CR
        ' 56    Column (numeric-nz) with CR
        ' 57    Column (numeric-nz) without CR
        ' 58    Total with CR
        ' 60    Paragraph
        ' 61    Paragraph (next 255 characters of text)
        ' 62    Load Key Column Data
        ' 63    Dump Key Column Data
        ' 64    Clear Key Column Data
        ' 70    If
        ' 71    End if
        ' 72    If-Break Area
        ' 73    End if-Break Area
        ' 74    Sub-Heading
        ' 75    End Sub-Heading
        ' 80    Sub report
        ' 81    End Sub report
        ' 82    Sub report RS loop start
        ' 83    Sub report RS loop end
        ' 100   Output column to text file

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  21. #21
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Re: how do print in vb 6.0

    There is a lot if IP there - nice. Thanks for the pointer. If I have time I may give that a go.
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  22. #22
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: how do print in vb 6.0

    Quote Originally Posted by szlamany
    We found Crystal to be too cumbersome and too limited in ability.

    We choose to develop our own report writer engine - it's actually a very simple task. We store "print objects" in a SQL table and loop through our data recordset and loop through the "print objects" and user .CURRENTX and .CURRENTY to produce extremely high quality reports.

    Whenever a new twist comes down the pike, we simply enhance our report writer engine - it's extremely simple.

    Last twist was to print the PO # on a purchase order vertically down the right side.
    I saw the post where you list some of the printer objects you store, and how you use them. Is what you are doing properity to your company?

    I ask because if it is not, I think it would be very cool if you put together a little demo of how your 'print engine' works, and placed it in the Code Bank or Utility section. If you wouldn't be violating any copywrites, I think an example of this would be extremely beneficial to folks that don't have access to a report generator, and who don't have the existing skill set to create their own.

    Just a thought...

  23. #23
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: how do print in vb 6.0

    Unfortunately it is proprietary - so I cannot put it on the code bank.

    I have no problem sharing my concepts with those that ask.

    Maybe in a year or so we will be marketing it outside the realm of our own applications.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  24. #24
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: how do print in vb 6.0

    it would be very cool ......., and placed it in the Code Bank or Utility section........, I think an example of this would be extremely beneficial to folks that don't have access to a report generator, and who don't have the existing skill set to create their own.
    We could do the Classic VB programmers a big favor, if we did something along the lines of what you suggested.
    It may very end up not being a single solution, but rather a set of a few solutions. If we find free (or dirt cheap) solutions along the lines of David's suggestions, then they may be part of our set.
    If anyone is interested in furthering this, I think the first task is 'to clearly identify the problem' (the needs).
    Can I start the ball rolling -
    Some of the solutions may be code, and some be controls(if we can't get the source)
    Any solutions must be free or extremely cheap.
    They must not be complicated to install/distribute.
    They must be reasonable easy to use ( or prior users be prepared to share the results of their learning curve)
    etc

    To illustrate why I think more than one solution may be required, we should cater for -
    Print preview, as I don't wish to re-visit the days of printing off 10's of pages whilst trying to get the layout just right.
    Normal reports (which can run to many pages).
    Portrait and Landscape.
    Embedded graphics.
    Print Grid(s)
    Print Form would be nice. This may be either a means to print the image on the screen, or something like what I use, which 'reads' the Form, and 'scrapes' the text, and box outlines etc. ('Hi Res' from Rod Stephens 'Graphics Programming' book).
    I'm happy to let it throw to the default printer, but some of you may wish more control ?


    Wouldn't it be ironic, that whilst 'Kill Bill' is trying to bury VB6, we provided the 'Holy Grail' that VB'ers have been searching for, for years.
    Last edited by RobCrombie; Mar 29th, 2005 at 09:10 PM.
    Rob C

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width