• 0

Set Boolean to opposite in VB


Question

I am fairly new to VB.Net so please bear with me.

I have a situation where a Sub turns things on or off depending on a boolean passed into it. I would like to pass the boolean and use it to set visible (and readonly) properties of controls.

Lets assume valueBoolean = True. Some I want turned on (*.visible = valueBoolean). But there are some in the same Sub that I want turned off (*.visible = THEOPPOSITEOFvalueBoolean). I wanted to use <> (*.visible <> valueBoolean), but that isn't allowed.

I created a simple function called switchBoolean that does this. It finds the value of valueBoolean and returns the opposite (*.visible = switchBoolean(valueBoolean)). This works fine, but is there another way to do this that doesn't need a function call?

Thanks for the help.

Link to comment
https://www.neowin.net/forum/topic/543740-set-boolean-to-opposite-in-vb/
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Thanks for the post, but in VB, <> is the closest to != in C++ that I can find. From what I can see, setting a boolean to <> does not set a TRUE to FALSE or vice-versa. Booleans must be True or False. It would make sense if it is TRUE, then != TRUE would be FALSE, but it doesn't work that way. Any other sugestions?

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Microsoft changes hit Teams Android devices: Disable Entra ID policy to restore sign-in by Paul Hill As part of its Secure Future Initiative, Microsoft has deployed a new Entra ID Conditional Access policy targeting Device Code Flow authentication. Unfortunately, it has led some Microsoft Teams-certified Android devices (Teams Rooms on Android, Teams Phones, Teams Panels, and Teams Displays) to be logged out and signing back in can be a bit fiddly so guidance has been shared. Microsoft said that it shared previous guidance which explained how to exclude Android devices, but it seems some admins didn’t catch this as many devices were not excluded and have been signed out. It’s important to realize that this is not a bug, it’s a security feature. However, the move could have been better communicated. To sign the devices back in, you can do so manually. However, if the devices are remote you’ll need to follow these steps: By disabling the “Block device code flow” policy in step 1, it will change everything back to how it was before Microsoft decided to enable it to boost security. This will allow you to get those affected Android devices logged back in again. Also pay special attention to step 2 which says you might need to reboot your device three times. Once you have your Android devices logged in again, it’s probably a good idea to follow Microsoft’s previous guidance and add these to an exclusion list before re-enabling the “Block device code flow” policy. Microsoft recommends only allowing DCF where it’s absolutely necessary and then blocking it elsewhere. The best thing to do is to add your Teams Android device to the exclusion list - this will allow these devices to operate normally, while boosting overall security. If you’re an admin and have been impacted by this, be sure to take proactive measures to avoid disruptions in the future.
    • Can someone help me with writing a batchfile using notepad to tell me to start a vpn plz? I would greatly appreciate any help  
    • Yeah define not catching up then to see the next part of this then
    • RoboForm 9.7.7 by Razvan Serea RoboForm is the top-rated Password Manager and Web Form Filler that completely automates password entering and form filling. RoboForm makes logging into Web sites and filling forms faster, easier, and more secure. RoboForm memorizes and securely stores each user name and password the first time you log into a site, then automatically supplies them when you return. RoboForm's powerful Logins feature eliminates the manual steps of logging into any online account. With just one click RoboForm will navigate to a Web site, enter your username and password and click the submit button for you. Completing long registration or checkout forms is also a breeze. Simply click on your RoboForm Identity and RoboForm fills-in the entire form for you. You no longer need to remember all your passwords. You remember one Master Password, and RoboForm remembers the rest. This allows you to use stronger passwords, making your online experience more secure. RoboForm uses strong AES encryption for complete data security. The all new RoboForm comes with Chrome and Safari browser support, iPhone/iPad and Android support, as well a brand new RoboForm Everywhere license for use on unlimited computers and mobile devices. RoboForm 9.7.7 changelog: Show RF Desktop unlock UI when user selects "Unlock" in RF Desktop UI. Fixed blank icon appeared in the Windows taskbar for RF Editor. Miscellaneous bug fixes. Download: RoboForm 9.7.7 | 42.2 MB (Free, paid upgrade available) View: RoboForm Website Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • Reacting Well
      SteveJaye earned a badge
      Reacting Well
    • One Month Later
      MadMung0 earned a badge
      One Month Later
    • One Month Later
      Uranus_enjoyer earned a badge
      One Month Later
    • Week One Done
      Philsl earned a badge
      Week One Done
    • Week One Done
      Jaclidio hoy earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      438
    2. 2
      ATLien_0
      158
    3. 3
      +FloatingFatMan
      149
    4. 4
      Nick H.
      65
    5. 5
      +thexfile
      62
  • Tell a friend

    Love Neowin? Tell a friend!