Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

VS 2008 How can I pass a form control to a function and access the controls on that form?

$
0
0
In VB6 I could pass a form to a function so that if i had similar forms with some of the controls named the same, the function could acess them.

When I try to do this is VS 2008 get an error, "'txtSocialSecurity' is not a member of 'System.Windows.Forms.Form'."

Is there some way to do this?
Code:

If not ValidateClient(Me) then ...

Function ValidateClient(ByRef targetForm As System.Windows.Forms.Form) As Boolean
    If targetForm.txtSocialSecurity.text = "" Or Len(targetForm.txtSocialSecurity.text) <> 9 Then
        ValidateClient = False
    End If
End Function

Thanks!

Viewing all articles
Browse latest Browse all 42215

Trending Articles