Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Automatic printing with VB.Net.

Automatic printing with VB.Net.

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasequestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    John Kh
    wrote on last edited by
    #1

    Suppose I have an application that takes orders and save them in an Access databse. And after taking each order I need to print a summary of that order. The summary should contain the items, prices, order number... I need to automatically print this summary right after I save the order. Can this be done in VB.net? I tried to save the orders in a table called Order1 & the summary in a table called Summary. And I retrieved the need information from Summary to a new form. But this form is being only printed at run time, which I want to avoid? So is there any way to automatically print the summary for each order, right after the order itself? I am using a VB.Net application with an Access database. Thank you in advance. John,

    P D C 3 Replies Last reply
    0
    • J John Kh

      Suppose I have an application that takes orders and save them in an Access databse. And after taking each order I need to print a summary of that order. The summary should contain the items, prices, order number... I need to automatically print this summary right after I save the order. Can this be done in VB.net? I tried to save the orders in a table called Order1 & the summary in a table called Summary. And I retrieved the need information from Summary to a new form. But this form is being only printed at run time, which I want to avoid? So is there any way to automatically print the summary for each order, right after the order itself? I am using a VB.Net application with an Access database. Thank you in advance. John,

      P Offline
      P Offline
      paas
      wrote on last edited by
      #2

      It is not clear to me what you mean by wanting to avoid printing at run time but... If you want to print via .NET you will need to work with the PrintDocument class (System.Drawing.Printing namespace). I am certain you can find some articles on this site and/or via an internet google that provide examples of working with the PrintDocument class. Good luck with your project.

      J 1 Reply Last reply
      0
      • J John Kh

        Suppose I have an application that takes orders and save them in an Access databse. And after taking each order I need to print a summary of that order. The summary should contain the items, prices, order number... I need to automatically print this summary right after I save the order. Can this be done in VB.net? I tried to save the orders in a table called Order1 & the summary in a table called Summary. And I retrieved the need information from Summary to a new form. But this form is being only printed at run time, which I want to avoid? So is there any way to automatically print the summary for each order, right after the order itself? I am using a VB.Net application with an Access database. Thank you in advance. John,

        D Offline
        D Offline
        David Mujica
        wrote on last edited by
        #3

        Here's a thought ... 1) Create your report with MS-Acess 2) Create a macro in MS-Access that Opens the report and uses the default view of Print, then quits Access; call it myMacro 3) From the command line you could use this syntax to have the report automatically generated: "msaccess c:\temp\db1.mdb /x myMacro" The idea is that from your VB.net program, you issue the above command line and have MS-Access do the report for you.

        1 Reply Last reply
        0
        • P paas

          It is not clear to me what you mean by wanting to avoid printing at run time but... If you want to print via .NET you will need to work with the PrintDocument class (System.Drawing.Printing namespace). I am certain you can find some articles on this site and/or via an internet google that provide examples of working with the PrintDocument class. Good luck with your project.

          J Offline
          J Offline
          John Kh
          wrote on last edited by
          #4

          The only function I found & worked with me was a function that prints a form at run time. Which means to print the desired form I should open the form, and with a button click on that form the pritings is intiated. Otherwise, The print function will print me the background & not te summary of th order I want. You get my point now? It is kinda complicated actually. I just can't find the correct printing function. John,

          P 1 Reply Last reply
          0
          • J John Kh

            The only function I found & worked with me was a function that prints a form at run time. Which means to print the desired form I should open the form, and with a button click on that form the pritings is intiated. Otherwise, The print function will print me the background & not te summary of th order I want. You get my point now? It is kinda complicated actually. I just can't find the correct printing function. John,

            P Offline
            P Offline
            paas
            wrote on last edited by
            #5

            You can definitely do what you want to do via the PrintDocument class/object when the order is received, as opposed to just using some function that automatically prints a form with a button click sometime after the order. With the PrintDocument class you would programitically do the formatting (output lines, fonts, etc.) and tell the object what printer to use. It is a little complicated but, once again, there are article examples floating around on this site and elsewhere on the web.

            1 Reply Last reply
            0
            • J John Kh

              Suppose I have an application that takes orders and save them in an Access databse. And after taking each order I need to print a summary of that order. The summary should contain the items, prices, order number... I need to automatically print this summary right after I save the order. Can this be done in VB.net? I tried to save the orders in a table called Order1 & the summary in a table called Summary. And I retrieved the need information from Summary to a new form. But this form is being only printed at run time, which I want to avoid? So is there any way to automatically print the summary for each order, right after the order itself? I am using a VB.Net application with an Access database. Thank you in advance. John,

              C Offline
              C Offline
              compad
              wrote on last edited by
              #6

              You may generate html document from the same database, and run javascript for printing this page, this page may blink for a while and also write close window command in javascript. May this help. Happy Programming.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups