Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Form Problem

Status
Not open for further replies.

dedo8816

Programmer
Oct 25, 2006
94
GB
Hi, Im using Visual Basic 2008 .net

On one particular form within my program i have 2 text boxes, when a user enters text into them and clicks print, the text entered is copied onto 2 labels in a seperate form. The seperate form has been set up to represent a paper label 4" x 4" (actual paper label) which will then print from the label printing machine.

The problem ive encountered is that when i click print, the label comes out half covered in black ink and the other half looks like parts of the desktop i.e. whatever was showing on the desktop when i printed. I resolved this by adding frmprintpr.show() to my form load, if i move the frmprintpr to a clear part of the screen i dont have this problem.

What causes this and is there a resolution?
I know people say that .printform was limited and useless but for all i used it for it was a great thing to be able to do, why did they ever get rid of it when writing up .net?

Thanks in advance

D
 
Just FYI for anyone having the same problem,

printform is not as easy from .net as it was from VB6, in anycase i found that when i was printing a form using the graphics.getimage it was printing out a black page.
I later discovered that i had to .show the form i was printing and update the information being shown on it before printing. This printed what i wanted but it was more of a mini screen dump that was printing, so when the form to be printed was behind something else on the screen it would print out everything infront of it.

He was my solution

FrmPrintPrv.SetDesktopLocation(2000, 2000) looks simple and stupid because it it, i basically told the form to load up way off screen, this means no one interfers with the open form and no one can put anything infront of it to mess up the print.

If anyone knows a better way to get away with this im open to all suggestions but for now im sorted...

Hope this post helps someone..
D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top