Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

[86] Printing in VB

Last post 09-27-2005 9:43 AM by bakuretsu. 61 replies.
Page 4 of 5 (62 items) < Previous 1 2 3 4 5 Next >
Sort Posts: Previous Next
  • 04-07-2005 6:44 PM In reply to

    • rcruz
    • Top 200 Contributor
    • Joined on 03-31-2005
    • Addicted Member
    • Points 505
    do while not rec.EOF
      printer.print rec.fields("name")  & vbTab & rec.fields("phone_nr")
    rec.Movenext
    loop

    don't know if this is what you mean...
    • Post Points: 0
  • Advertisement

    • Red Gate Software

    Advertisement

    Want to boost your .NET application performance?

    Some developers always seem to write efficient and lightening-fast code. What is their secret? It’s ANTS Profiler. “We improved the performance of the application up to 10 times” Dan Ports, Intrigma.

    Try it for yourself now.

  • 04-13-2005 9:36 AM In reply to

    • gianni
    • Not Ranked
    • Joined on 04-13-2005
    • New Member
    • Points 10
    can one add the functionality to print a  logo  easily when printing directly to the printer ?

    I want to add a logo to till receipt slips (small thermal printer) and just wondering how it could be done
    • Post Points: 0
  • 04-13-2005 8:21 PM In reply to

    • gianni
    • Not Ranked
    • Joined on 04-13-2005
    • New Member
    • Points 10
    excellent thanks!
    • Post Points: 0
  • 04-23-2005 11:38 AM In reply to

    • suhaas
    • Not Ranked
    • Joined on 04-23-2005
    • New Member
    • Points 10

    Problem In Win 2000

    Dear Sharaf / Forum Members,

    I am also facing similiar problem with VB6. I am using Generic Text Printer in Windows 2000. I want to assign Custom paper size to the printer but it is not working. It works with Win98. Have you got the solution? If yes please forward me.

    Thanking you in advance.
    • Post Points: 0
  • 05-13-2005 2:28 PM In reply to

    • jglennie
    • Not Ranked
    • Joined on 05-13-2005
    • New Member
    • Points 10
    Hi, I am also trying to print a table in VB.net, but I seem to have less experience than gianni because I'm having trouble understanding your directions.  I have a few questions after reading your solution.

    First, is the recordset the same thing as a dataset?  Or, could I load the contents of the table into a dataset and print from the dataset?  If I can't print from a dataset, do I load the information from the dataadapter into the recordset in the same way that I would put the information into a dataset?  

    Finally, I'm having trouble understanding the loop.  Let me know if this is incorrect:


    do while not rec.EOF                                                                       <---- Lop until you reach the end of record set?
     printer.print rec.fields("name")  & vbTab & rec.fields("phone_nr")     <---- I have no idea....
    rec.Movenext                                                                                 <---- Does this increment some kind of index in the recordset that indicates the current
    loop                                                                                                       record?  


    Thank you for any help you can provide.

    jglennie

    • Post Points: 0
  • 05-14-2005 3:35 PM In reply to

    • rcruz
    • Top 200 Contributor
    • Joined on 03-31-2005
    • Addicted Member
    • Points 505
    Well, a recordset is a coolection of records (rows) of a db table.
    So, when you open a recordset with a Sql query, it get's filled with the query results (or not filled at all if the query dosen't return any results.
    But if it does get filled, you must move along the returnd rows to get their data.

    example:
    Code:

    set rec=new adodb.recorset
    set conn=new adodb.connection

    conn.open "your connection string" 'do a google search ob ado connection strings if you don't know what this is.
    'also check my site's code lib. I posted there a function to build connection strings easy.

    rec.open "select * from myphonebook order by name,phonenr", Conn ' load query results into the recordset
    do while not rec.eof 'loop through all the results
      printer.print rec.fields("name") & vbTab & rec.fields("phonenr")
      'print the name and phone nr. of the current row separated by a TAB
      rec.movenext 'move to the next row on the recordset
    loop
    rec.close 'close the recordset
    conn.close 'close the db connection

    set rec=nothing 'destroy the object
    set conn=nothing 'destroy the object

    printer.enddoc 'start printing


    hope it helps
    • Post Points: 0
  • 05-14-2005 3:41 PM In reply to

    • rcruz
    • Top 200 Contributor
    • Joined on 03-31-2005
    • Addicted Member
    • Points 505
    I'm currently developing a DLL to make printing easy in VB. Next week I'll relese the Beta1 version of this module.
    If you like to post some suggestions that you find usefull, email suggest@rc-dev.com .
    • Post Points: 0
  • 05-16-2005 4:15 PM In reply to

    • jglennie
    • Not Ranked
    • Joined on 05-13-2005
    • New Member
    • Points 10
    Thank you.... I understand it better now.  I guess I didn't realize how many ways you can accomplish the same things in VB with different code.  For instance, the code you use to connect and query a database is different than mine, but its more clear now that I see the whole thing.  Thanks for the help!  
    • Post Points: 0
  • 06-04-2005 3:42 PM In reply to

    • rcruz
    • Top 200 Contributor
    • Joined on 03-31-2005
    • Addicted Member
    • Points 505

    VB printer component

    I've developed a compontent to make printing in VB easier.
    Some common tasks as printing images, wrapped text, objects, etc. are coded on the component's methods.
    Test it for yourself. Visit http://www.rc-dev.com
    • Post Points: 0
  • 06-18-2005 12:31 AM In reply to

    • Squire
    • Not Ranked
    • Joined on 06-18-2005
    • New Member
    • Points 35

    Duplex printing

    I am attempting to print to a 'HP LazerJet 2420d' printer that has duplex capabilities but I can not get it to print the back side of the paper.  I am coding in VB6 and I know the duplex on the printer works because another program that I did not write works fine. Any help?  I've tried everything I can think of.
    • Post Points: 0
  • 06-24-2005 7:03 AM In reply to

    Facing Paper size printing problem in Win XP

    email me

    I Am facing problem with printer.print when i use in Win Xp. setting paper size have no effect when use it in xp but its working correctly  in win 98

    have seen this question in this forum but can't find the replies

    hope you can help me, i am using vb6

    thanks.

    email me
    • Post Points: 0
  • 07-04-2005 9:51 AM In reply to

    • aadreja
    • Not Ranked
    • Joined on 07-04-2005
    • New Member
    • Points 15

    custom paper size in xp

    for setting custom paper size in xp
    u have to create form...

    go to start->settings->printers
    in file menu go to "server properties"
    create new from with desired paper size... and give name

    now u can see newly created paper while printing
    • Post Points: 0
  • 07-04-2005 1:51 PM In reply to

    • suhaas
    • Not Ranked
    • Joined on 04-23-2005
    • New Member
    • Points 10
    hi aadreja,

    thanks for your reply.

    I tried to do as per your reply. But this does not work with VB6. I am working on a invoice printing application where I am using Generic Text printer with VB6. Please help me if you have any solution.

    Thanks in advance.

    Regards,
    Suhaas
    • Post Points: 0
  • 07-04-2005 3:32 PM In reply to

    • aadreja
    • Not Ranked
    • Joined on 07-04-2005
    • New Member
    • Points 15

    problem in printing

    hi suhaas

    have u added new paper...

    now go to properties of your generic printer..
    in printing preferences select default paper instead of letter select ur created custom paper...

    now open vb6 and write code "msgbox printer.papersize"
    this will give u paper no which windows has assigned...

    so now when writing ur code..
    instead of

    printer.papersize=256
    printer.width=your width
    printer.height=your height


    replace 256 with ur custom paper no...
    and height and width will be automatically adjusted as per you custom paper created...

    printer.papersize=your custome paper size no


    like this u can solve it..

    i hope things are clear

    if more doubts feel free to ask
    • Post Points: 0
Page 4 of 5 (62 items) < Previous 1 2 3 4 5 Next >