How do I hide a button when printing?

1.4k Views Asked by At

After searching for a solution on the internet, I found this on CodeProject from 2007:

VisibleWhilePrinting = false

This does not seem to exist in VB.Net. Is there something out there that I can use to hide a button when printing a form? (other than manually setting the button's "visible" property to hidden every time the form is printed).

Thanks.

1

There are 1 best solutions below

9
On

Why don't you create a method that handle's this type of behaviour? The code you provided is probably a variable that is referenced somewhere in the code to determine what needs to take place, for ex:

 Dim VisibleWhilePrinting As Boolean = False

Then this can be used or set anywhere and then used where you need it to. In order to hide a button just depends on why you need to hide it. As you have already stated about the visible property of the button itself. So as I have said, create a method and call it or a function...

UPDATE

As @varocarbas has mentioned, there isn't a automatic way of acheiving this, only manually.