473,473 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to access Explorer...Print function from code?

I have a button on my form to "Print". I would like to create an
HTML file, of the output, and call the Explorer...Print function when
this "Print" button is clicked. How can I do this - the
Explorer...Print part? I can create the HTML file, just need help with
calling the Explorer...Print function - supplying the path to the file
so that only the Print Dialog pops up once they click on "Print"

Thanks!
Jul 14 '08 #1
3 2595
Printing in windows forms is not normally performed like that. Printing is
normally done with a PrintDocument class which has an event which you handle
to do the printing which is done by GDI type drawing.
The easiest/cheapest/dirtiest way of doing what you want would be with a
Browser control. You could load the HTML into the browser control and call
the print function on that. That would then work just like internet explorer.

--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Andrew Meador" wrote:
I have a button on my form to "Print". I would like to create an
HTML file, of the output, and call the Explorer...Print function when
this "Print" button is clicked. How can I do this - the
Explorer...Print part? I can create the HTML file, just need help with
calling the Explorer...Print function - supplying the path to the file
so that only the Print Dialog pops up once they click on "Print"

Thanks!
Jul 14 '08 #2
Hello,

look at this: http://www.codeproject.com/KB/printing/printhml.aspx

Hope it helps.

Leo

"Andrew Meador" <an****@meadorcrafts.comwrote in message
news:04**********************************@t54g2000 hsg.googlegroups.com...
I have a button on my form to "Print". I would like to create an
HTML file, of the output, and call the Explorer...Print function when
this "Print" button is clicked. How can I do this - the
Explorer...Print part? I can create the HTML file, just need help with
calling the Explorer...Print function - supplying the path to the file
so that only the Print Dialog pops up once they click on "Print"

Thanks!
Jul 14 '08 #3
On Jul 14, 11:58*am, "Leo Seccia" <lsec...@msn.comwrote:
Hello,

look at this:http://www.codeproject.com/KB/printing/printhml.aspx

Hope it helps.

Leo

"Andrew Meador" <and...@meadorcrafts.comwrote in message

news:04**********************************@t54g2000 hsg.googlegroups.com...
* I have a button on my form to "Print". I would like to create an
HTML file, of the output, and call the Explorer...Print function when
this "Print" button is clicked. How can I do this - the
Explorer...Print part? I can create the HTML file, just need help with
calling the Explorer...Print function - supplying the path to the file
so that only the Print Dialog pops up once they click on "Print"
Thanks!- Hide quoted text -

- Show quoted text -
Thanks Leo - this was what I was looking for. Got it done and it
works perfectly. I HATE windows printing. I have been looking at
ASP.NET programming a bit lately and didn't see why I shouldn't just
have my app create an HTML file/report and use this method to print
the html file. I seems to me that this is a lot easier than dealing
with the whole GDI/drawing approach. I get tables, borders, fonts,
etc... without having to deal with the font size calculations, line
spacing/tracking, etc...

If there is any other way that you guys recommend, I'm all ears,
but until then - I like this method! :)

Andrew
Jul 15 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Michael | last post by:
Hallo I have the following problem: Within a web application I have to access the Java methods from JavaScripts. I'm using Sun's Java virtual machine version 1.3.1. Webbrowser is Microsoft...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
1
by: Andrew Arace | last post by:
I scoured the groups for some hands on code to perform the menial task of exporting table data from an Access 2000 database to Oracle database (in this case, it was oracle 8i but i'm assuming this...
8
by: mytfein | last post by:
Hi Everyone, Background: Another department intends to ftp a .txt file from the mainframe, for me to process. The objective is to write a vb script that would be scheduled to run daily to...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
5
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp The Joy of Interoperability Sometimes a revolution in programming forces you to abandon all...
16
by: John | last post by:
I am looking for VBA code that will work with Access 2003 to enable dragging and dropping a file/folder name from Windows XP Explorer into an Access form's text box. This is a common functionality...
2
by: crazyhouse | last post by:
Hi, I dont even know where to start on this one. I found this on the net (everything in italics are the authors comments): Public Function OpenFirstAttachmentAsTempFile(ByRef rstCurrent As...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.