[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 149
  • Last Modified:

Check for data in textboxes and comboxes

I have attached a file.  In it, you will see that I have a VB6 form with many rows of inputting information.

What I am trying to do is make sure the form gets filled out completely.  For example.  If a person enters a date and CCMs, then the form needs to check that the rest of the row is filled out otherwise they cannot click Next.

How can I accomplish this?

0
al4629740
Asked:
al4629740
  • 4
  • 4
  • 2
1 Solution
 
GrahamSkanCommented:
The file appears to be more detached than attached - i.e. you seem to have forgotten it.
0
 
al4629740Author Commented:
0
 
Martin LissRetired ProgrammerCommented:
A few questions.

Are the controls all members of control arrays? For example are the controls under 'Date" named like Mydate(0), MyDate(1), etcetera?

Do all rows have to be completed or is just a few rows okay as long as all the fields are filled out in those rows?

Can the user skip a row, for example fill in rows 1,2, 4 1nd 5?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
GrahamSkanCommented:
Sorry. That doesn't seem to be very helpful. I have loaded it as a Word document.

However, I don't really understand how it could contain a VB6 form,
0
 
Martin LissRetired ProgrammerCommented:
Private Sub cmdNext_Click()
    Dim intCount As Integer
    Dim bOK As Boolean
    
    ' This doesn't care about skipped rows
    
    bOK = True
    For intCount = 0 To txtDate.Count - 1
        If txtDate(intCount).Text <> "" Then
            If txtCCM(intCount).Text > "" And _
               cboMtgType(intCount).Text > "" And _
               cboSubType(intCount).Text > "" And _
               txtPurpose(intCount).Text > "" Then
               ' Row OK
            Else
                bOK = False
                Exit For
            End If
        End If
    Next
    
    If bOK Then
        MsgBox "One or more rows not completely filled out"
        Exit Sub
    End If
    
    ' The rest of the code in the sub goes here
            
End Sub


Private Sub txtDate_Change(Index As Integer)

    cmdNext.Enabled = False
    
End Sub

Open in new window

0
 
Martin LissRetired ProgrammerCommented:
Sorry, line 22 should be

If Not bOK Then
0
 
al4629740Author Commented:
Thanks Martin!

I will take a look at it shortly
0
 
al4629740Author Commented:
Are the controls all members of control arrays? For example are the controls under 'Date" named like Mydate(0), MyDate(1), etcetera?
Yes

Do all rows have to be completed or is just a few rows okay as long as all the fields are filled out in those rows?
No

Can the user skip a row, for example fill in rows 1,2, 4 1nd 5?
yes
0
 
al4629740Author Commented:
I made a couple changes and it works like a champ.  Thanks again


Dim intCount As Integer
    Dim bOK As Boolean
    
    ' This doesn't care about skipped rows
    
    bOK = True
    For intCount = 0 To MR6Date.Count - 1
        If MR6Date(intCount).text <> "" Then
            If MR6CCM(intCount).text <> "" And _
               MR6MtgType(intCount).text <> "" And _
               MR6SubType(intCount).text <> "" And _
               MR6Purpose(intCount).text <> "" Then
               ' Row OK
            Else
                bOK = False
                Exit For
            End If
        End If
    Next
    
    If bOK = False Then
        MsgBox "One or more rows not completely filled out"
        Exit Sub
    End If

Open in new window

0
 
Martin LissRetired ProgrammerCommented:
Glad I could help.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now