Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, I'm creating a function where it edits an HTML file, loads it into a web browser control and then print the HTML document. The web browser loads the HTML file but doesn't print it. It's all in one function. I even tried using ShowPrintDialog method. But it does nothing!!! Not even an error message!!! Please help!!!

One more thing: When I right click the browser control and select print it prints fine.

EDIT - Copied from Comment
I've found it. It takes hell of a lot of time to show the print dialog. That's what's causing the problem. And Interestingly that happens only if I put the print method in a button. The Original code is like this:

VB
browser.DocumentText = html 'the HTML code for the page 
browser.Refresh() 
browser.Print() 


In the changed code I call the print function in a separate button_click event. It works but very slow. I want this whole thing automated.
Posted
Updated 2-Aug-11 18:43pm
v2
Comments
Sergey Alexandrovich Kryukov 3-Aug-11 0:10am    
It can be anything. Please, make a minimal code sample and explain what did not work in proper detail. Better yet, run it step-by-step under debugger and see what's going on. If you still fail to see what's wrong, ask a question, but properly. Use "Improve question" above.
--SA
obhasha07 3-Aug-11 0:17am    
I've found it. It takes hell of a lot of time to show the print dialog. That's what's causing the problem. And Interestingly that happens only if I put the print method in a button.

The Original code is like this:
browser.DocumentText = html 'the HTML code for the page
browser.Refresh()
browser.Print()

In the changed code I call the print function in a seperate button_click event.
It works but very slow. I want this whole thing automated.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900