Click here to Skip to main content
15,032,967 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to use printform for the below. It is cutting off at the bottom. I have no margins around the border. Form is big enough to see the below.

Screenshot - 8d1e20cbde3665233b2240389ee4377d - Gyazo[^]

Me.PrintForm1.PrinterSettings.DefaultPageSettings.Margins = New System.Drawing.Printing.Margins(0, 0, 0, 0)
       Me.PrintForm1.PrinterSettings.DefaultPageSettings.Landscape = False
       Me.PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

What I have tried:

Not really sure what to try. Form Height is Max size and margin cant get any smaller.
Updated 23-Oct-20 19:53pm
Gerry Schmitz 24-Oct-20 0:41am
Change "something" if you want to see what works when. Then make notes. Or "print to PDF" first if you need some sort of confirmation.

1 solution

Basically, don't use PrintForm: if you want to print a document use the PrintDocument Class (System.Drawing.Printing) | Microsoft Docs[^] instead. It takes a bit more work, but it produces much better results and gives you full control over what is printed and where.

PrintForm is "legacy code" which is intended to let older VB code work without conversion and rarely does much that is useful in the real world.
Cody O'Meara 28-Oct-20 18:01pm
Works perfectly! Thank you
OriginalGriff 29-Oct-20 3:19am
You're welcome!

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