|
-
Sep 24th, 2002, 01:32 PM
#1
Thread Starter
Hyperactive Member
Quick help please.
hi this is probably simple, but i can't figure it.
How do i make a button only enabled when all 4 of my text boxes have something written in them.
ay the mo i am trying:
command1.enabled=false
if text1.datachanged=true & text2.datachanged=true & _
text3.datachanged=true & text4.datachanged=true then
command1.enabled=true
endif
But it don't work
please help.
-
Sep 24th, 2002, 01:40 PM
#2
Frenzied Member
Code:
If txt1.Text <> "" AND txt2.Text <> "" AND txt3.Text <> "" AND txt4.Text <> "" Then
'do this
else
command1.enabled = True
end if
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Sep 24th, 2002, 01:46 PM
#3
VB Code:
Private Sub VerifyEntries()
'hack
'This works by multiplying the lengths of the required fields together. If any field is empty, the result sum
'will be 0. VB treats a 0 as false and non-zero as true. Therefore, when all of the fields have an entry
'the sum will be greater than 0, hence, True and the command button will become enabled
Command1.Enabled = Len(Trim$(Text1.Text)) * Len(Trim$(Text2.Text)) * _
Len(Trim$(Text3.Text)) * Len(Trim$(Text4.Text)
End Sub
Private Sub Text1_Change()
VerifyEntries
End Sub
Private Sub Text2_Change()
VerifyEntries
End Sub
Private Sub Text3_Change()
VerifyEntries
End Sub
Private Sub Tex4_Change()
VerifyEntries
End Sub
-
Sep 24th, 2002, 01:48 PM
#4
Thread Starter
Hyperactive Member
thanks allot it works now, dunb ass me, why didn't i think of greater than
thx
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
|