Dear all,
I have create a web browser by vb.net and use it for open excel file and print it out.
But printDocument seems cant working well. Is there any method to call the web browser Printer? :confused:
Please give me a help, thanks a lot:) :p
Printable View
Dear all,
I have create a web browser by vb.net and use it for open excel file and print it out.
But printDocument seems cant working well. Is there any method to call the web browser Printer? :confused:
Please give me a help, thanks a lot:) :p
Can you explain that further? Posting your code would also help.Quote:
But printDocument seems cant working well
Thanks hellswraith ;)
I know there is some error, but I can't find it :(
My source code:
------------------------------------------------------------------------
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("http://www.kcg.com/doc/c_doc11.xsl")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
On Error Resume Next
Dim eQuery As OLECMDF
eQuery = Me.WebBrowser1.QueryStatusWB(OLECMDID_PRINT)
If Err.Number = 0 Then
If eQuery And OLECMDF_ENABLED Then
Me.WebBrowser1.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, "", "")
Else
MsgBox("Printer Not Found or No Contents in Webbrowser")
End If
End If
End Sub
End Class
NEVER use on error resume next in VB.NET ...instead use try, catch and finally blocks..and of course that if some error happens u'd never know which and why because u have that crappy on error resume next..!
Thanks PT Exorcist.
Type "OLECMDF" is not defined.
It means no this function in vb.net :confused: :(
Your going to need to locate that com object and add a reference to it in order to use it. I have no idea where to look for it though. I have had problems like this before when trying to get functionality from older com components and such.
I tried, but fail:( :(Quote:
Originally posted by hellswraith
Your going to need to locate that com object and add a reference to it in order to use it. I have no idea where to look for it though. I have had problems like this before when trying to get functionality from older com components and such.
Is there any other method to print in WebBrowser?:confused: