valide selection...

collinm

Registered User.
Local time
Today, 15:28
Joined
Apr 20, 2006
Messages
14
hi

i do a little check before run code
Code:
Public Function validationValue() As Boolean
    If lstTransit.ItemsSelected.Count > 0 And txtDate.Text <> "" And txtHeureDebut.Text <> "" And txtHeureFin.Text <> "" Then
        validationValue = True
    Else
        validationValue = False
    End If
End Function

after i check the result
Code:
Dim fctReturnn As Boolean
fctReturnn = validationValue
If fctReturnn = True Then
..
else
  msgbox "erreur..."
endif

when this code run, i get:


Run-time error '2185'
You can't reference a property or method for a control unless the control has the focus


what is the correct way to validate user input?

any idea?

thanks
 
Use the .Value property rather than the .Text in your function. The .Value property is the default property so you could actually just leave off the .Text on the three test and it would work correctly.
 

Users who are viewing this thread

Back
Top Bottom