2020年5月22日 星期五

vb.net 列印指定的檔案 [List select file]


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Dim DocumentName As String = "C:\PNT.pdf"
        Dim objProcess As New System.Diagnostics.ProcessStartInfo

        With objProcess
            .FileName = DocumentName
            .WindowStyle = ProcessWindowStyle.Hidden
            .Verb = "print"

            .CreateNoWindow = True
            .UseShellExecute = True
        End With
        Try
            System.Diagnostics.Process.Start(objProcess)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

沒有留言:

張貼留言