|
-
May 31st, 2002, 10:00 PM
#1
Thread Starter
Member
1 Question On TextBox. Help.
Is there anyway to trigger a button when the length of my textbox reach a length of 8 ?
For example, when i type the 8th character on the txtbox, it will automatically trigger a button.
thanks.
-
May 31st, 2002, 10:06 PM
#2
Hyperactive Member
Add this code to a form with a command button (named Command1)
and a text box (named Text1)
Code:
Option Explicit
Private Sub Command1_Click()
MsgBox "The number of characters in the textbox is: " & Len(Text1.Text)
End Sub
Private Sub Text1_Change()
If Len(Text1.Text) >= 8 Then
Call Command1_Click
End If
End Sub
Sometimes what you're looking for is exactly where you left it.
-
May 31st, 2002, 10:07 PM
#3
Hyperactive Member
Private Sub Command1_Click()
MsgBox "it works"
End Sub
Private Sub Text1_Change()
If Len(Text1.Text) = 8 Then Command1.Value = True
End Sub
-
May 31st, 2002, 10:08 PM
#4
Lively Member
VB Code:
Private Sub Text1_Change()
If Len(Text1) > 7 Then
Command1.Enabled = True
End If
End Sub
There's something I've noticed in the last year or so...
Australian's are good at EVERYTHING !!!
-
May 31st, 2002, 10:12 PM
#5
The picture isn't missing
i would go with JohnVB.........
changing the value or making it enabled wont call the command's sub
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
May 31st, 2002, 10:16 PM
#6
Hyperactive Member
Buggy,
I beg to differ. Setting the Command button's Value property to True will fire the button click event.
Check it out.
-
May 31st, 2002, 10:18 PM
#7
Lively Member
lol.. i always get stuff wrong.. sorry whoever asked the question, i misread it
There's something I've noticed in the last year or so...
Australian's are good at EVERYTHING !!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|