Vb.Net - How to stop duplex on a printer
-
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.
-
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.
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!
-
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.
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.
-
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!
Thanks for the speedy reply. How would this code/structure be displayed on the project. Sorry for this.
-
Thanks for the speedy reply. How would this code/structure be displayed on the project. Sorry for this.
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!
-
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!
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.
-
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.
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 twoDebug.Print
lines, if you like and you must changemo.SetPropertyValue("Duplex", True)
tomo.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!