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
  1. Home
  2. General Programming
  3. Visual Basic
  4. Sending text to the printer

Sending text to the printer

Scheduled Pinned Locked Moved Visual Basic
question
6 Posts 2 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.
  • M Offline
    M Offline
    MikeMarq
    wrote on last edited by
    #1

    I'm trying to have my program display the PrintDialog and then print out some text. I assumed it would work similar to the open and save dialogs but when I try to double click on the printdialog it refuses to produce an event for when the person clicks the print button. Can someone explain what is going wrong and how I can print a string of text. thanks Mike

    S 1 Reply Last reply
    0
    • M MikeMarq

      I'm trying to have my program display the PrintDialog and then print out some text. I assumed it would work similar to the open and save dialogs but when I try to double click on the printdialog it refuses to produce an event for when the person clicks the print button. Can someone explain what is going wrong and how I can print a string of text. thanks Mike

      S Offline
      S Offline
      Smithers Jones
      wrote on last edited by
      #2

      You need a printdialog and a printdocument. When printdialog's dialogresult=okay use printdocument.print to call the printdocument.printpage-event. There you have to use graphics.drawstring-method to print your string.

      "I love deadlines. I like the whooshing sound they make as they fly by." (DNA)

      M 1 Reply Last reply
      0
      • S Smithers Jones

        You need a printdialog and a printdocument. When printdialog's dialogresult=okay use printdocument.print to call the printdocument.printpage-event. There you have to use graphics.drawstring-method to print your string.

        "I love deadlines. I like the whooshing sound they make as they fly by." (DNA)

        M Offline
        M Offline
        MikeMarq
        wrote on last edited by
        #3

        Thank you for your help. But I have a follow up question, when I double click on the printdocument I dragged and dropped into the program it creates a subroutine. However, when I run the program and click the print button of the printdialog it doesn't trigger the event. What is the event that the print button triggers? thanks again, Mike

        S 1 Reply Last reply
        0
        • M MikeMarq

          Thank you for your help. But I have a follow up question, when I double click on the printdocument I dragged and dropped into the program it creates a subroutine. However, when I run the program and click the print button of the printdialog it doesn't trigger the event. What is the event that the print button triggers? thanks again, Mike

          S Offline
          S Offline
          Smithers Jones
          wrote on last edited by
          #4

          printdialog1.document = printdocument1 if printdialog1.showdialog = dialogresult.ok then printdocument1.printpage

          "I love deadlines. I like the whooshing sound they make as they fly by." (DNA)

          M 1 Reply Last reply
          0
          • S Smithers Jones

            printdialog1.document = printdocument1 if printdialog1.showdialog = dialogresult.ok then printdocument1.printpage

            "I love deadlines. I like the whooshing sound they make as they fly by." (DNA)

            M Offline
            M Offline
            MikeMarq
            wrote on last edited by
            #5

            Thank you again for your help. But I still don't know what event this code goes into because the printdocument1.printpage event isn't triggered and printdialogs don't appear to allow events. thanks, Mike

            S 1 Reply Last reply
            0
            • M MikeMarq

              Thank you again for your help. But I still don't know what event this code goes into because the printdocument1.printpage event isn't triggered and printdialogs don't appear to allow events. thanks, Mike

              S Offline
              S Offline
              Smithers Jones
              wrote on last edited by
              #6

              You put a button somewhere on your form that is usually labeled "print". Put the code in this button's click-event. This is very basic stuff, you really should get a book, if you don't know how to do that.

              "I love deadlines. I like the whooshing sound they make as they fly by." (DNA)

              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