Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 597789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:19:06+00:00 2026-05-13T16:19:06+00:00

This is probably going to end up as a stupid question, but countless research

  • 0

This is probably going to end up as a stupid question, but countless research has offered me no results.

I know there are different types of errors I want to check for, and when I should be throwing an exception for “exceptional” errors, and that I should create validating functions for input and other checks.

My problem is, how do I send an error back to a page when the data entered fails in a separate class?

For Example:

  • User input entered in Page1.aspx, click calls Submit() in Class.vb
  • Class.vb finds that input is invalid
  • How do I update Page1.aspx label to say “Hey, that is not right”.

I can do it on inline page, no problem, its passing it through a separate class that’s causing me issues… Maybe I’m not even thinking of this correctly.

Any points in the right direction would be of huge help.

Thanks for the help in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:19:06+00:00Added an answer on May 13, 2026 at 4:19 pm

    The simplest solution is to have Submit() return a boolean indicating whether there was an error or not:

    If class.Submit() = False Then
        lblError.Text = "Hey, that is not right."
    End If
    

    It is a good practice to put your class in charge of its own errors, in which case you would expose an error message property:

    If class.Submit() = False Then
        lblError.Text = class.GetErrorMessage()
    End If
    

    The Submit function would look something like this:

    Public Function Submit() As Boolean
        Dim success As Boolean = False
        Try
            ' Do processing here.  Depending on what you do, you can
            ' set success to True or False and set the ErrorMessage property to
            ' the correct string.
        Catch ex As Exception
            ' Check for specific exceptions that indicate an error.  In those
            ' cases, set success to False.  Otherwise, rethrow the error and let
            ' a higher up error handler deal with it.
        End Try
    
        Return success
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

You can probably see where I am going with this - but is there
I know this probably has been asked before but I am having issues with
This is probably going to be a no, but is there any way I
This is probably a stupid question, but my brain is just cooked enough I
This is probably going to sound like a sci-fi request, though – is there
This is probably going to be an easy thing but I am having a
This probably has a one click solution, i know debugging web pages in VS2010
This probably is a dummy question but I cannot find a clear indication. I
I know this probably really simple but Im not sure what im doing wrong...
Im sorry for this probably dumm question, but I want to simply open modals

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.