|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
March 22nd, 2004, 06:53 PM
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
printing without printDialog on mult. printers
Hi there, I hope you can help me!
This is what I'm trying :
I'm writing software for a registry sytem for restaurant.
On the server I have 2 printers connected, 1 printing to kitchen and 1 printing to bar. If a waiter keys in an order and presses the finish button the full order moves into a TempOrder database table.
Every item listed in the order has a specified printer to go to.
I put all the data for printer 1 in printDatasetP1 and read it out in a string. The string is being printed to printer 1. I mannegged to make it work with PrintDialog but I don't want this cause then you still need to push the butoon OK and set the printer to go to in the showdialogForm.
Who can help me are nows a link where i can start searching how to set in code where each dataset (Printer1, and printer2) needs to be send to WITHOUT USING THE DIALOGRESULT
tHIS IS THE CODE i USE NOW
Private Sub finish_order_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBestellingAfsluiten.Click
fill_TempOrder()
print_Order()
delete_tempOrder()
Me.Hide()
End Sub
Public Function delete_tempOrder()
Dim thisOrder As Artikel = New Artikel()
thisOrder.deleteTempOrder(_tafelnummer)
End Function
Public Function print_Order()
Dim i As Integer
Dim thisBarOrder As Artikel = New Artikel()
thisBarOrder = thisBarOrder.findOrderByPrinter(orderDataset, _tabelnr, 1)
i = orderDataset.Tables(0).Rows.Count
If i > 0 Then
printOrder()
End If
Dim thisKitchenOrder As Artikel = New Artikel()
thisKitchenOrder = thisKitchenOrder.findOrderByPrinter(orderDataset, _tafelnummer, 2)
i = orderDataset.Tables(0).Rows.Count
If i > 0 Then
printOrder()
End If
End Function
Public Function printBestelling()
Dim objPrintDialog As PrintDialog = New PrintDialog()
Dim objPrintDocument As New Drawing.Printing.PrintDocument()
objPrintDocument.DocumentName = "Order"
objPrintDialog.Document = objPrintDocument
AddHandler objPrintDocument.PrintPage, AddressOf Me.pagePrintTempOrder
If objPrintDialog.ShowDialog = DialogResult.OK Then
Try
objPrintDocument.Print()
Catch ex As Exception
End Try
End If
objPrintDocument.Dispose()
objPrintDialog.Dispose()
End Function
Public Sub pagePrintTempOrder(ByVal sender As Object, ByVal e As Printing.PrintPageEventArgs)
Dim lineHeight, lineNumber As Single
Dim i, y As Integer
Dim strData1, strdata2 As String
Dim titelFont As Font = New Font("Monotypa Cursiva", 14)
Dim bodyFont As Font = New Font("Monotypa Cursiva", 10)
Dim now As Date = New Date()
y = orderDataset.Tables(0).Rows.Count
For i = 0 To y - 1
strData1 = strData1 & (orderDataset.Tables(0).Rows(i).Item(1).ToString) & " " & (orderDataset.Tables(0).Rows(i).Item(0).ToString) & vbCrLf
Next
i = 0
e.Graphics.DrawString("Tafel :" & _tafelnummer & vbCrLf & "uur : " & now.TimeOfDay.ToString, titelFont, Brushes.Black, 0, 0)
lineNumber += 2
e.Graphics.DrawString(strData1, bodyFont, Brushes.Black, 0, 50)
lineNumber += 1
End Sub
Hope to hear from you soon
Frank
Frank Vandeven
Belgium
__________________
Frank Vandeven
Belgium
|
March 23rd, 2004, 10:20 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
The question for the ages. I have NEVER found anyone who could give me a way to print without the print dialog box...
Hal Levy
Web Developer, PDI Inc.
NOT a Wiley/Wrox Employee
|
March 24th, 2004, 02:15 PM
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
http://www.faqts.com/knowledge_base/view.phtml/aid/9169
Don't know if it works, and if it does, it's IE only.
Besides, printing without the box, that could run your ink dry just by visiting a web site. It would be a major security issue.
----------
---Snib---
----------
<><
|
March 24th, 2004, 03:06 PM
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thank you but I don't think it's usefull cause I'm writing a windows application, in vb.net not ASP.net web service.
Frank Vandeven
Belgium
|
March 24th, 2004, 04:15 PM
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
OK I'm done,
It's as simple as can be.
set your printer name in a string
ex : dim barPrinter as string = "barPrinter" 'actual name of the specified printer
Delete If Me.dialogResult = dialogResult.OK()
add : objPrintDocument.PrinterSettings.PrinterName() = barPrinter
push the printButton and out comes the monkey.
HIP HIP HOERA for me.
Thank you.
Frank Vandeven
Belgium
|
March 24th, 2004, 04:55 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
I edited the previous entry to remove masked profanity.
Hal Levy
Web Developer, PDI Inc.
NOT a Wiley/Wrox Employee
|
January 10th, 2005, 11:14 AM
|
Registered User
|
|
Join Date: Jan 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
Did anyone get this code to work? I have been trying to print without the print dialog that comes up with the cancel button when I do a print screen. When I added the code:
Delete If Me.dialogResult = dialogResult.OK()
I get name Delete is not declared. Is there some code or delete procedure missing? Any help will be greatly appreciated.
Thanks,
Wai
|
January 10th, 2005, 11:42 AM
|
Registered User
|
|
Join Date: Jan 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ok, found the answer. Here is my code:
'Make a PrintDocument and print.
m_PrintDocument = New PrintDocument
'Hide print dialog
Dim printControl = New StandardPrintController
m_PrintDocument.PrintController = printControl
m_PrintDocument.Print()
Wai
|
|
|