?
Solved

neat way of saying not(boolean)

Posted on 2003-12-01
2
Medium Priority
?
248 Views
Last Modified: 2011-09-20
I am using VB6:

My code is as follows:
                    dim tEnabled as boolean
                    If .Enabled = "EnableIfElectronic" Then
                        tEnabled = isElectronic
                    ElseIf .Enabled = "DisableIfElectronic" Then
                        tEnabled = not(isElectronic)  'note the 'not() in this line is obviously only my wishful thinking.
                    End If


I know I could write a quickfunction, or just add any extra 'if statement' ie:
                    dim tEnabled as boolean
                    If .Enabled = "EnableIfElectronic" Then
                        tEnabled = isElectronic
                    ElseIf .Enabled = "DisableIfElectronic" Then
                         if isElectronic then    
                                 tEnabled = false
                         else
                                 tEnabled = true
                        endif
                    End If


Just wondering if their is a neater way of doing this, such as a not() type function??

Thanks,
Cassandra
0
Comment
Question by:calebS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

by:
dbrckovi earned 120 total points
ID: 9848778
Just remove brackets:

 tEnabled = Not isElectronic

Example:
Private Sub Command1_Click()
    Dim a As Boolean
    Dim b As Boolean
    a = True
    b = Not a
    Print a, b
End Sub
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 10167083
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered dbrckovi
 
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

leonstryker
EE Cleanup Volunteer
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question