Results 1 to 7 of 7

Thread: Web Browser

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2003
    Posts
    41

    Question Web Browser

    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?

    Please give me a help, thanks a lot

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    But printDocument seems cant working well
    Can you explain that further? Posting your code would also help.

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2003
    Posts
    41
    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

  4. #4
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    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..!
    \m/\m/

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2003
    Posts
    41
    Thanks PT Exorcist.

    Type "OLECMDF" is not defined.
    It means no this function in vb.net

  6. #6
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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.

  7. #7

    Thread Starter
    Member
    Join Date
    Jan 2003
    Posts
    41
    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.
    I tried, but fail
    Is there any other method to print in WebBrowser?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width