Using the Papersource attribute to select a Paper Tray
I have an HP Laser with 2 Trays: a manual feed and a lower paper tray
I am using the following to get the paper source:
Private
Function GetPaperSource(ByVal psAs PrinterSettings,ByVal KindAs PaperSourceKind)As PaperSourceDim pscAs PaperSourceForEach pscIn ps.PaperSourceIf psc.Kind = KindThenReturn pscEndIfNext' No match? Simply return the 0th source.Return ps.PaperSources(0)EndFunctionIn my Print Click event for the manual tray option button:
Private
Sub btnPrint_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles btnPrint.ClickPrintDocument1.DefaultPageSettings.PaperSource = GetPaperSource(PrintDocument1.PrinterSettings, PaperSourceKind.Manual)
PrintDialog1.Document = PrintDocument1
If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OKThenPrintDocument1.Print()
EndIfEndSubIn my Print Click event for the lower tray option button:
PrivateSub btnPrint_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles btnPrint.Click
PrintDocument1.DefaultPageSettings.PaperSource = GetPaperSource(PrintDocument1.PrinterSettings, PaperSourceKind.Lower)
PrintDialog1.Document = PrintDocument1
If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OKThen
PrintDocument1.Print()
EndIf
EndSub
No matter what I try this is not working. The Printer defaults to Automatic Feed andif there is paper in the manual tray then it always selects the manual tray. I am not able to successfully execute the option to select the lower tray. I have tried searching on Google and I cannot find an answer. The printer default is AUtomaticFeed and I am no able to override that programmatically.

