I'm programming for a friend to help them print all files in a folder (after filtering them). I've gotten to the point where I am able to select a folder, filter the files according to extension, and list them in a ListBox. I'm thinking that I'm going to have to Loop 1) Get "File1 Name", 2) Print File1, and 3) Go to the next item, Until there are no more files. So I'm testing it out on just a regular textbox where I input the location of file "C:\Users\akapp\OneDrive\Documents\AAppleton Midterm.pdf." Is there a way to do GetFiles and Print after using a button?
This is the Print Dialogue I'm using:
Private Sub BtnPrint_Click(sender As Object, e As RoutedEventArgs) Handles btnPrint.Click
Dim printDoc As New PrintDocument()
Dim printDlg As New PrintDialog With {
.Document = printDoc,
.PrinterSettings = printDoc.PrinterSettings,
.AllowSomePages = True
}
If printDlg.ShowDialog = Windows.Forms.DialogResult.OK Then
printDoc.PrinterSettings = printDlg.PrinterSettings
printDoc.Print()
End If
End Sub
It works fine, but just prints a blank page.
I've tried
printDoc.DocumentName = txtTest.Text
but that does not work... ;-;
Any help is very appreciated. ^u^
Also I am a very new programmer. Like, started this past week with this project.