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 8696743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:20:40+00:00 2026-06-13T01:20:40+00:00

I may be having a senior moment here ( at 22 years old ),

  • 0

I may be having a senior moment here (at 22 years old), but I can’t figure out why C# is skipping a statement I have included after a switch. The code goes as follows:

switch (shape)
{
    case ToolShape.BasicTool:
        EditTool = (LastTool.ToolType == ToolShape.BasicTool)
            ? new BasicTool((BasicTool)LastTool)
            : new BasicTool(ToolNumber, BasicToolType.TypeA,
                "Tool " + ToolNumber, "", 1.0, 60.0, 0.0, 0.0, 0.0, 10.0);
        break;

    case ToolShape.AdvancedTool:
        EditTool = (LastTool.ToolType == ToolShape.AdvancedTool)
            ? new AdvancedTool((AdvancedTool)LastTool)
            : new AdvancedTool(AdvancedTool, "Tool " + ToolNumber, "", 1.0, 10.0, 2.0, 
                AdvancedTool.Light, AdvancedTool.Round);
        break;

    case ToolShape.SpecialTool:
        EditTool = (LastTool.ToolType == ToolShape.SpecialTool)
            ? new SpecialTool((SpecialTool)LastTool)
            : new SpecialTool(SpecialTool, "Tool " + ToolNumber, "", 
                1.0, 1.0, 90.0);
        break;
}

// We never seem to reach anything below here ----------------
LoadToolToForm(EditTool); 

It’s never hitting that LoadToolToForm(EditTool) statement. Or a MessageBox.Show("...") I stuck in there, for debugging purposes. Removing the switch works as expected. Putting even a really small switch in there with a single case causes it to exit prematurely again, though.

Is this known behavior? Is there a situation in which breaking from a switch statement causes the function to exit (without ever invoking the return keyword).

  • 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-06-13T01:20:41+00:00Added an answer on June 13, 2026 at 1:20 am

    If you are sure the code is never passing the switch statement, there is only one other possibility:

    There is an exception being thrown in the switch statement, and it is being caught somewhere higher up so the program just continues.

    One thing you could try to verify this suggestion would be wrapping your switch in a temporary try{}catch{} block and showing a MessageBox on Exception, or use lots of breakpoints.

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

Sidebar

Related Questions

I may be having a silly problem here... I can't seem to figure out
I may be hopelessly lost here, but having come from a MVC.NET world I
I may have a misunderstanding but I was under the impression that having a
I may have gone completely braindead today, but I'm having trouble copying my DB
I may just be having trouble with the error-handling documentation, but what I have
It may just be that I've checked out already for the weekend, but having
As many of you may already know I have been having issues with another
This may be something common and trivial, but I seem to be having trouble
This may be a beginners question but not having much luck getting this going.
I have begun work on a personal project that may end up having some

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.