Enjoy life Zom
Enjoy life Zom

Reputation: 1

How to get printDocument in Visual Studio 2015 VB.net print by ticket dialog with numeric count

I want to printDocument in Visual Studio 2015. I set ticket Dialog, but I can't print with dialog. It does work.

example: I want to print only page 3, but it prints the whole document.

enter image description here

Control with a button:

Private Sub bt_print_Click(sender As Object, e As EventArgs) Handles bt_print.Click
        If barcode_color = "--: --:--" Then
            MsgBox("Please input detail priint ..", MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "not input print")
        Else
            'Dim result As Integer = MessageBox.Show("เปลี่ยนกระดาษ Label เป็นสี """ + barcode_color + """ หรือยัง ?", "", MessageBoxButtons.YesNo)
            Dim id As String = "NO" + DateTime.Now.ToString("yyyyMMddHHmmss")
            'If result = DialogResult.No Then
            'ElseIf result = DialogResult.Yes Then
            countpage = barcode_qty_prn
            pageall = 0
            numberbox = barcode_qty_last

            With Ticket_Dialog
                .Document = Label_Document
                .AllowSomePages = True
                .AllowCurrentPage = True
                .AllowSelection = True
                .AllowPrintToFile = True
                .ShowNetwork = True
                .PrinterSettings.FromPage = no_page.Value
                .PrinterSettings.ToPage = no_page.Value

            End With

            If Ticket_Dialog.ShowDialog() = DialogResult.OK Then
                Label_Document.PrinterSettings = Ticket_Dialog.PrinterSettings
                Label_Document.Print()
            End If
            '  '''    Label_Document.PrinterSettings.PrinterName = "iR-ADV C5840i" '"" '"iR-ADV C5840i"
        End If
    End Sub

I want to print with numeric 1 page.

Upvotes: 0

Views: 11

Answers (0)

Related Questions