Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting the value of a control to opposite boolean 1

Status
Not open for further replies.

Jean9

Programmer
Dec 6, 2004
128
US
I have written a function that is passed a boolean value that I am using to set the visibility of the controls on the form. In some instances, though "True" is passed, I still want to set some control's visibility to false. How can I still use the passed parameter in an opposite fashion instead of hard coding "false" or "true" whichever opposite applies?
For example:

Code:
Private Sub ManipulateControls(sCRIT As String, bSetCtl As Boolean)
     Select Case sCRIT
        Case "AddUser"
            Me.CmdDELUSER.Visible = False
            Me.CmdADDUSER.Visible = bSetCtl
I don't want to use "false" here, I would like to use an opposite of bSetCtl while still using the parameter bSetCtl
Thanks for any help,
J9
 
Code:
Private Sub ManipulateControls(sCRIT As String, bSetCtl As Boolean)
     Select Case sCRIT
        Case "AddUser"
            Me.CmdDELUSER.Visible = False
            Me.CmdADDUSER.Visible = [red]NOT[/red] bSetCtl
 
You either need two functions or pass not(bSetCtl) to the single function depending on the circumstances.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 

How about...
Code:
Private Sub ManipulateControls(sCRIT As String, bSetCtl As Boolean)
     Select Case sCRIT
        Case "AddUser"
            Me.CmdDELUSER.Visible = [COLOR=red]Not bSetCtl[/color]
            Me.CmdADDUSER.Visible = bSetCtl

Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top