How to find out why a switch case loops infinitely?
<p>I use the following switch case to read different types of input, and whenever I reach a semicolon the output just loops infinitely (semi colon detected ;). One solution I found for something like this suggested checking input again after all the cases and I already do that in my code. I can't determine why it is looping and getting stuck on a semicolon.</p>

<pre><code>     while (inputType != 0) 
    {
        switch (inputType)
        {
            case 1: // alpha
                {
                } // end case 1

            case 3: // numeric
                {
                } // end case 3

            case 5: // delimeter
                {
                    break;
                } // end case 5

            case 6: // space
                {
                    readChar(ref sentenceIX, ref sentence, ref inputChar, ref inputType);

                    if (inputType == 6)
                    {                                
                        readChar(ref sentenceIX, ref sentence, ref inputChar, ref inputType);
                        MessageBox.Show("Space detected " +inputChar);
                    } // end if
                    break;
                } //end case 6

            case 7: // semi colon
                {
                    readChar(ref sentenceIX, ref sentence, ref inputChar, ref inputType);
                    if (inputType == 7)
                    {
                        MessageBox.Show("Semi Colon detected  " +semiColonChar);
                        readChar(ref sentenceIX, ref sentence, ref inputChar, ref inputType);
                    }
                    break;
                }

            default:
                {

                    break;
                }
        } // end switch

    } //end while
</code></pre>

<p>I have also tried making the case 6 and 7 "if" instead of "while" and no change. I use a textbox for the string and I suspect it may be not letting go of the final char (;) in the string, and if so how would I make it do so?</p>