Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-10-23
2
Medium Priority
?
191 Views
Last Modified: 2010-05-02
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
0
Comment
Question by:On_The_Level
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Expert Comment

by:coopzz
ID: 12387896
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
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 150 total points
ID: 12388099
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

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question