James
James

Reputation: 1489

How to grey out / disable a button control in Win Forms?

Can someone please provide an example of how to grey out a button control?

I have tried DownloadButton.IsDisabled and don't know what else to try.

Upvotes: 31

Views: 79631

Answers (4)

ScruffyDuck
ScruffyDuck

Reputation: 2666

Use this to disable a control:

DownloadButton.Enabled = false;

Use this to hide it entirely:

DownloadButton.Visible = false;

Upvotes: 10

RhythmicRobot
RhythmicRobot

Reputation: 41

DownloadButton.Enabled = false;

This will disable the button and make it fade out.

Upvotes: 4

Jason Cheng
Jason Cheng

Reputation: 345

DownloadButton.Enabled = false;

Above code disables the button (It looks gray, and can't receive the click event)

Hope this is helpful!!

Upvotes: 17

Fredou
Fredou

Reputation: 20120

DownloadButton.Enabled = false;

Upvotes: 53

Related Questions