MaQleod
MaQleod

Reputation: 999

vb.net hide button text or make image on button cover text

I dynamically create buttons on a form and use the button text as ids so that I can pass that to an SQL query to pull saved data about that button when necessary, but I also use an image over buttons that have information saved about them. What I need to know is how do I keep the text on the button from appearing when there is an image assigned to that button? By default vb.net shows both the text and the image and no TextImageRelation values allow for the image to take precedence. I tried changing the text color to transparent, but the outline of the text is still visible through the image. Is there anyway to keep the text value as it is but just show the image on the button?

Upvotes: 1

Views: 4487

Answers (3)

Rex Mallari Oliveros
Rex Mallari Oliveros

Reputation: 21

To Enable "Button1" Click (Visible)

Button1.Enable = True

To Disable "Button1" Click (Visible)

Button1.Enable = False

Hide "Button"

Button1.Visible = True

or

Button1.Show()

Show "Button"

Button1.Visible = False

or

Button1.Hide()

You can Also Used the code to any Tools (TextBox, Label, ComboBox, Radio Button, Button, Link, GroupBox)

Upvotes: 0

Stewbob
Stewbob

Reputation: 16899

Don't use the .Text property of the button to store your information. Use the .Tag property for your IDs. Just set the .Text property to "" (empty string), that way it won't interfere with your image.

Upvotes: 3

Jay
Jay

Reputation: 2703

not sure, but why not just set the value to a variable to be passed to the SQL on the button click event and not place the text on the button? If you are using the same button click event for several buttons you could check the sender's ID and then set the variable based on that.

Upvotes: 0

Related Questions