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. Vb.Net - How to stop duplex on a printer

Vb.Net - How to stop duplex on a printer

Scheduled Pinned Locked Moved Visual Basic
questioncsharptutorial
7 Posts 3 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.
  • C Offline
    C Offline
    Central_IT
    wrote on last edited by
    #1

    Hi, I am printing Crystal reports via VB.Net. Some of the printers are set to print duplex others are not. I want to set the printers duplex option to off when ever I run the code. What is the best way of doing this. What do I have to import/do to achieve this? I have tried importing SystemManagement but no success. What am I doing wrong. Any sample would be welcome.

    H L 2 Replies Last reply
    0
    • C Central_IT

      Hi, I am printing Crystal reports via VB.Net. Some of the printers are set to print duplex others are not. I want to set the printers duplex option to off when ever I run the code. What is the best way of doing this. What do I have to import/do to achieve this? I have tried importing SystemManagement but no success. What am I doing wrong. Any sample would be welcome.

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      Well you should definitely be able to do it using WMI and the Win32_PrinterConfiguration[^] structure. This[^] thread on MSDN has the basics.

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus!

      C 1 Reply Last reply
      0
      • C Central_IT

        Hi, I am printing Crystal reports via VB.Net. Some of the printers are set to print duplex others are not. I want to set the printers duplex option to off when ever I run the code. What is the best way of doing this. What do I have to import/do to achieve this? I have tried importing SystemManagement but no success. What am I doing wrong. Any sample would be welcome.

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        I tend to install duplex capable printers twice, once for simplex, and once for duplex. Then it is all a matter of choosing the right printer. :)

        Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

        1 Reply Last reply
        0
        • H Henry Minute

          Well you should definitely be able to do it using WMI and the Win32_PrinterConfiguration[^] structure. This[^] thread on MSDN has the basics.

          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus!

          C Offline
          C Offline
          Central_IT
          wrote on last edited by
          #4

          Thanks for the speedy reply. How would this code/structure be displayed on the project. Sorry for this.

          H 1 Reply Last reply
          0
          • C Central_IT

            Thanks for the speedy reply. How would this code/structure be displayed on the project. Sorry for this.

            H Offline
            H Offline
            Henry Minute
            wrote on last edited by
            #5

            Central_IT wrote:

            How would this code/structure be displayed on the project.

            Normally it wouldn't be 'displayed' so I am a little confused by your question.

            Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus!

            C 1 Reply Last reply
            0
            • H Henry Minute

              Central_IT wrote:

              How would this code/structure be displayed on the project.

              Normally it wouldn't be 'displayed' so I am a little confused by your question.

              Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus!

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

              Hi, I think I am getting mixed up. The question I meant was "How can I set the code so that my printer does not print duplex" What is the syntax and what class do I import. It has been a long time since I did any real coding and I am a wee bit rusty. You can properly tell with this question...getting old.

              H 1 Reply Last reply
              0
              • C Central_IT

                Hi, I think I am getting mixed up. The question I meant was "How can I set the code so that my printer does not print duplex" What is the syntax and what class do I import. It has been a long time since I did any real coding and I am a wee bit rusty. You can properly tell with this question...getting old.

                H Offline
                H Offline
                Henry Minute
                wrote on last edited by
                #7

                If you click on the second link in my first reply and scroll down to the answer from 'JWolf011' and look at the code he has posted. You have not show us the code you are using so I cannot tell you exactly where you should put that code but for an example suppose that you have a Button to turn off Duplex. Double-click the Button to get the template for its Click handler in your code window. Inside the new handler type the code from that link (leave out the two Debug.Print lines, if you like and you must change mo.SetPropertyValue("Duplex", True) to mo.SetPropertyValue("Duplex", False)). Then when you run your application and click that Button it should turn off Duplex. Then do your normal printing. If it works then move the code into your normal print routine.

                Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus!

                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