Results 1 to 4 of 4

Thread: Cleaning up my if statments

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    547

    Cleaning up my if statments

    Basically if i wanted my controls to be checked at startup id use a setting obviously

    Code:
            'UI Settings
            chkCloseToTray.Checked = My.Settings.CloseToTray
            chkAlwaysShowSystemTrayIcon.Checked = My.Settings.AlwaysShowTrayIcon
            chkMinimizeToTray.Checked = My.Settings.MinimizeToTray
    and so on, but what if i wanted to disable a control if a setting was true???

    Code:
    'form load
    chkRandomSafeColor.Checked = My.Settings.RandomColor
    under that would be next

    Code:
                lblClickToChangeSafeHighlightColor.Enabled  = 'what would go here????
                pbHighlightColor.Enabled

    Would there be some sort of IsNot my.setting.....

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Cleaning up my if statments

    A simple not should be sufficient...

    txtSomeTextBox.Enabled = Not My.Settings.SomeSetting

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    547

    Re: Cleaning up my if statments

    so simple

    thanks

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Cleaning up my if statments

    Remember to mark your thread resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width