If saveDataToDB() = True Then 'if second or net value is greater than zero ticket will be printed' If Val(txtSWeight.Text) > 0 Or Val(txtNetWeight.Text) > 0 Then 'this function loads last updated ticket that according to autonumber' PrintFunc(" WHERE dbo.tbl_Tickets.QS_Code=" & CInt(lblQS_Code.Text)) rtb_TicketFormat.Rtf = rtb_TicketFormat.Rtf.Replace("Duplicate.png", "Original.png") Dim myFileName As String = IO.Path.Combine(IO.Path.GetTempPath, "_.html") rtb_TicketFormat.SaveFile(myFileName, RichTextBoxStreamType.PlainText) PrintTktz() End If Private Sub PrintTktz() Dim webBrowserForPrinting As New WebBrowser() 'Add an event handler that prints the document after it loads.' AddHandler webBrowserForPrinting.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf PrintDocumentz) 'Set the Url property to load the document.' webBrowserForPrinting.Url = New Uri(IO.Path.GetTempPath & "_.html") End Sub Private Sub PrintDocumentz(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs) Dim webBrowserForPrinting As WebBrowser = CType(sender, WebBrowser) webBrowserForPrinting.ScriptErrorsSuppressed = True 'Print the document now that it is fully loaded.' webBrowserForPrinting.Print() 'MessageBox.Show("print")' webBrowserForPrinting.Dispose() ' Dispose the WebBrowser now that the task is complete.' End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)