Results 1 to 7 of 7

Thread: [RESOLVED]Text1.text + Enabled + True? [PART 2!]

Threaded View

  1. #5
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Text1.text + Enabled + True?

    You can do it as a one-liner:
    Code:
    Private Sub TextBox1_Change()
        Command1.Enabled = (Len(TextBox1.Text) >= 10)
    End Sub
    Of course, I don't usually do it with only a single line. Anytime I set a control property in a procedure that can fire a bunch of times in quick succession, I tend to only set it if it has changed:
    Code:
    Private Sub TextBox1_Change()
        Dim blnEnabled As Boolean
        
        blnEnabled = (Len(TextBox1.Text) >= 10)
        With Command1
            If .Enabled <> blnEnabled Then .Enabled = blnEnabled 
        End With
    End Sub
    I do this because I'm irrationally averse to flicker.
    Last edited by Ellis Dee; Aug 14th, 2007 at 09:25 AM.

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