tags:

views:

10

answers:

1

I'm using a WebBrowser to print some HTML data, all works good except for the print preview called in the load completed event - It opens as a very small window in the top left, anything I can do to improve this?

Private Sub BtnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPrint.Click
    Dim webBrowserForPrinting As New WebBrowser()
    AddHandler webBrowserForPrinting.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf PrintDocument)
    webBrowserForPrinting.DocumentText = HTMLTEST()
End Sub

Private Sub PrintDocument(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs)
    Dim webBrowserForPrinting As WebBrowser = CType(sender, WebBrowser)
    webBrowserForPrinting.ShowPrintPreviewDialog()
End Sub
A: 

Try setting the Parent property of your webBrowserForPrinting object to Me.

webBrowserForPrinting.Parent = Me
klabranche
Ahh thats the one - Thanks!
madlan