Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27251

[RESOLVED] Grouping Enum's using Or when used as a parameter on a procedure

$
0
0
Hi, I am using a sub to handle the enabling/disabling of buttons on a form based on the Enum value provided as a parameter.

For example my Enum looks like this:

VB.NET Code:
  1. Enum ButtonState
  2.     EnableAll
  3.     DisableAll
  4.     EnableClipboard
  5.     DisableClipboard
  6.     EnableColouring
  7.     DisableColouring
  8. End Enum
Then in my sub I would use:

VB.NET Code:
  1. Public Sub SetButtonState(ByVal State As ButtonState)
  2.     Select Case State
  3.         Case ButtonState.EnableAll
  4.             'Enable Buttons
  5.         Case ButtonState.DisableAll
  6.             'Disable Buttons
  7.  
  8.         'etc
  9.     End Select
  10. End Sub
If I wanted to change the state of multiple groups of buttons would I be able to use the 'Or' or 'And' keyword? If so how would I go about this? I realise I can call the procedure more than once with the relevant argument but the problem I face is when I need to disable all the buttons while performing certain functions and then restore all of the button states back to how they were afterwards.

Thanks
Jay

Viewing all articles
Browse latest Browse all 27251

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>