Disable/Enable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • soramaster
    New Member
    • May 2007
    • 23

    #1

    Disable/Enable

    How do I make it where something disabled until you put some kind of code in, S/N?

    Like on some program trials it will need a code to enable some buttons.functio ns,etc.


    On mine I want some stuff disabled until you enter a code in to enable it.

    Like I want one of my command buttons disabled.

    Thanks
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    if you want to enable a command button when you write something into a text box, just check the sub

    [CODE=vb]Private Sub TextBox1_Change ()
    If TextBox1.Text <> "" Then
    CommandButton1. Enabled = True
    Else
    CommandButton1. Enabled = False
    End If
    End Sub[/CODE]

    And this way, also, when the txt box is cleared, the button will be disabled once again

    Comment

    • kadghar
      Recognized Expert Top Contributor
      • Apr 2007
      • 1302

      #3
      FYI

      That sub can be found when double clicking the textbox, in the upper left menu

      Kad

      Comment

      • kadghar
        Recognized Expert Top Contributor
        • Apr 2007
        • 1302

        #4
        Originally posted by kadghar
        FYI

        That sub can be found when double clicking the textbox, in the upper left menu

        Kad
        upper RIGHT (gee... you shouldn't let drunk people write posts around here)

        Comment

        • soramaster
          New Member
          • May 2007
          • 23

          #5
          Ok thanks ill give it a try

          Comment

          • soramaster
            New Member
            • May 2007
            • 23

            #6
            Sweet. Thanks alot. Now all I have to do is make it work with a S/N and I can start working on the other stuff.



            THANKS

            Comment

            • debasisdas
              Recognized Expert Expert
              • Dec 2006
              • 8119

              #7
              try this one also
              =============
              [CODE=vb]
              Private Sub TextBox1_Change ()
              Command1.Enable d = len(trim(TextBo x1.Text)) > 0
              End Sub
              [/CODE]

              Comment

              Working...