Posts Tagged ‘IsEnabled’

How To: Turning On or Off a Control with IsEnable and the “Not” Command

March 2, 2011

You can simplify the following VB.NET code snippet by using NOT instead of IIF

Code Snippet
  1.        DeleteButton.IsEnabled = IIf(DeleteButton.IsEnabled = True, False, True)

can be restated in a simplified syntax as

Code Snippet
  1. DeleteButton.IsEnabled = Not DeleteButton.IsEnabled

Advertisements