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

  • SEARCH
  • Home
  • 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 616685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:21:12+00:00 2026-05-13T18:21:12+00:00

I have a class called Website, and inside of that class I have the

  • 0

I have a class called “Website”, and inside of that class I have the following property:

public HtmlForm RegisterForm
{
    get
    {
        if (Forms.RegForm != null) / Forms is a custom object called HTMLForms that is a custom list collection
        {
            return Forms.RegForm;
        }
        else
        {
            // FindPageWithGoogle Google = new FindPageWithGoogle();
            // use Google.FindRegistrationForm(this.currentUrl) method
            //throw new Exception(); // if registration form object can't be found
        }
        return Forms.RegForm;
    }
}

Would this be an efficient way of handling the error? In the case of it not being found, how would I halt the entire flow of the program if this exception is thrown? I know how to use a simple try catch, but I don’t think that’s enough. I believe I need to learn how to make my own custom exception handling system to handle these custom events accordingly.

Thanks for any help. Also, if you have a specific book on exception handling, since the C# books i’ve read thus far didn’t go into the topic much, it would be greatly appreciated.

Thanks,

Cody

  • 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-13T18:21:13+00:00Added an answer on May 13, 2026 at 6:21 pm

    To terminate the code on an exception, just don’t catch it.

    You should create a meaningful exception class (e.g. InitializationError) and then throw that when the error occurs. Go out to the calling code that can display the message to the user and catch the exception there. You might also terminate the program at that point.

    As far as books on exception handling, I think you’ll find the MSDN chapter on exceptions helpful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class called Question that has a property called Type. Based on
I have a class called UserInfo that contains details about a given user. There
I have a class called ReportRequest as: public class ReportRequest { Int32 templateId; List<Int32>
I have this class called SiteAsyncDownload.cs Here's the code: public class SiteAsyncDownloader { WebClient
I have a class called Sprite, and ballSprite is an instance of that class.
I have an abstract class called Node . It contains a constructor that takes
I have created a new class called Get_WebPage1 and init I have extends that
I have a class called LocalizedString that is defined in an external library that
I have a visual studio website solution with the following structure A page called
I have a class called UserContext that tracks the activities of a given user

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.