Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello!. So we have a PDF that I am converting to a VB.net form in our project so I can pull in some of the data from SQL server to save time for our employees that do these.

The goal is that the employee will be prompted to enter an ORD# which will then auto fill most of the fields. They will proceed with making the proper adjustments. When they click the print button, it will set all textboxes to have no border so it looks nice, and then print. However, some textboxes, and a panel of the form is not displaying in print preview.

The Form: Screenshot - 934c4036b284e479dcaf601ce53f0e12 - Gyazo[^]

Print Preview:Screenshot - 856ae08f27134650e90ff4c08368b3f7 - Gyazo[^]


VB
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        'TextBox1.BorderStyle = BorderStyle.None

        PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Left = 5
        PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Right = 5
        PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Bottom = 5
        PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Top = 5


        Me.PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
        Me.PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)


End Sub

EDIT: So when I hide the labels with the underlines, the text boxes show. I set those labels to the back and textboxes to front but it still prints with them in the back... I tried setting the textbox to the front under the button_click and still nothing. Its weird that other textboxes and and panels containing the checkboxes are fine further down.... I thought maybe it was the viewable part of the form but when I made the form bigger, it looks the same.

What I have tried:

I have tried re adding the controls and adding back. I verified the missing controls are to the front.

When I remove the bold text from the from the bottom code line, the controls show but of course is not doing the whole scrollable form.
VB
Me.PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)
Posted
Updated 24-May-22 2:54am
v3
Comments
[no name] 26-May-22 14:03pm    
You should be looking at the Form; not the "print command". It looks like the check boxes aren't "anchored" properly (for scrolling) and are floating.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900