Popliteal
New member
- Joined
- Jul 9, 2025
- Messages
- 1
- Programming Experience
- Beginner
Hello. I have a form with a reportviewer in it. I am trying to set the orientation and paper size of the printer. It does NOT work. When the report viewer comes up, and you click the paper settings button it defaults to USER and not the default page settings set on the printer or the program I have written. Code is below.
VB.NET:
If layout = "114" Then ' 2" x .5" 1 label
With PrintPreview114.ReportViewer114
'.PrinterSettings.PrinterName = "\\GVL02\114 Label Printer (Assembly)" 'Intermec Printer PM4i
.PrinterSettings.PrinterName = "114 Label Printer (Assembly)" 'Intermec Printer PM4i
temstr = .PrinterSettings.PrinterName
goodprinter = TestPrinter(temstr) ' Test to see if printer is installed
If goodprinter = "" Then
MessageBox.Show("114 Lable Printer is not installed. Contact your Administrator.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
Exit Function
Else
If temstr <> goodprinter Then
.PrinterSettings.PrinterName = goodprinter
End If
End If
.ProcessingMode = ProcessingMode.Local
.PrinterSettings.Copies = lcnumoflabels
.LocalReport.DataSources.Clear()
.LocalReport.DataSources.Add(RDS)
.SetDisplayMode(DisplayMode.PrintLayout)
'Set the paper
.PrinterSettings.DefaultPageSettings.Landscape = False
'For Each h In .PrinterSettings.PaperSizes
'temstr = temstr
'Next
Try
.PrinterSettings.DefaultPageSettings.PaperSize = .PrinterSettings.PaperSizes(1)
Catch
MessageBox.Show("114 Label Printer needs to be setup. Check Paper sizes.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
Exit Function
End Try
.LocalReport.SetParameters(param1)
.LocalReport.SetParameters(param2)
.LocalReport.SetParameters(param3)
.LocalReport.SetParameters(param4)
.LocalReport.Refresh()
End With
'PrintPreview114.Show()
PrintPreview114.ShowDialog()
End If