How would i enable a command button after 3 or 4 text boxes have been filled in?????

How would i enable a command button after 3 or 4 text boxes have been filled in.  I want the user to fill the text boxes in with the info and once ALL the text boxes are filled in i then want the command button to become enabled so they can move onto the next area???
I am using VB6.

Cheers

GM
On_The_LevelAsked:
Who is Participating?
 
Ryan ChongConnect With a Mentor Commented:
or if you want instant effect, you can try put the validation code to the Changed event instead. like:

Private Sub Text1_Change()
    chkEnable
End Sub

Private Sub Text2_Change()
    chkEnable
End Sub

Private Sub Text3_Change()
    chkEnable
End Sub

Private Sub Text4_Change()
    chkEnable
End Sub

Private Sub chkEnable()
    Command1.Enabled = IIf(Len(Text1) > 0 And Len(Text2) > 0 And Len(Text3) > 0 And Len(Text4) > 0, True, False)
End Sub
0
 
coopzzCommented:
JUst run a check procedure in the lost focus or keypress event of the text boxes

ie:

sub textbox1_lostfocus()
  checkValadation()
end sub

...

sub checkValadation()
  if (len(textbox1.text ) > 0 ) then
    if (len(textbox2.text ) > 0 ) then
      if (len(textbox3.text ) > 0 ) then
        cmdOk.enabled = true
      end if
    end if
  end if
end sub

0
All Courses

From novice to tech pro — start learning today.