Results 1 to 3 of 3

Thread: passing a webpage as a parameter to a vb class function?

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    2

    passing a webpage as a parameter to a vb class function?

    Hello,
    I'm simply trying to validate textboxes and dropdownlists etc on an asp web form. I have the code to loop through all of the child controls on the htmlform, but I can't figure out how to pass an instance of the webform to a vb class function. I am doing this because I have to validate controls an several forms and it gives me more control over validation than if I used the gui provided in the toolbox (RequiredFieldValidator).
    Does anyone know how to do this?
    Thanks,
    Chieko

  2. #2
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Re: passing a webpage as a parameter to a vb class function?

    Ckuroda,

    Firstly welcome to the forums

    From the look of your question it appears that you have posted in the wrong forum, this is the ASP classic, VB Script forum which means you probably won't get as many responses as you'd like. In the future you should post asp.net related questions in the asp.net forum click here to check it out

    Right back to your question.

    In your class your create a function somthing like this -

    Code:
    Public Function Validation(ByRef myPage As Page) As Boolean
        Dim bRet As Boolean = True
            
        ' Loop page Or form If Error Do what you have To Do And Set bRet=False
            
    
        Return bRet
    End Function
    In the webform or webform codebehind page in the submit click event -

    Code:
    If myClass.Validation(Me)=True Then
        ' No Error call save Function
    Else
        ' An Error has occurred return To form displaying list of errors 
    End If
    Cheers Al

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    2

    Re: passing a webpage as a parameter to a vb class function?

    Al, Thanks. That did the job.
    Cheers,
    Chieko

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width