Coffeehouse Post

Single Post Permalink

View Thread: Select Case behavior
  • User profile image
    davewill

    Curious ... I've recently been doing some parsing of some old file structures and in the process put in a little trick I remembered using in the VB3-6 days.  Only it doesn't work in .NET 2.0 like that anymore.  That made me wonder if I really was remembering the past correctly (not exactly my strong suit!).

    In the VB3-6 days when MyVarWithNumber9InIt = 9 then it would go through both case statements for 9 in the select case block.  In .NET 2.0 it goes through the first case for 9 then jumps out.

    Select case MyVarWithNumber9InIt

    Case 1

    'do case 1 stuff

    Case 2

    'do case 2 stuff

    Case 9

    'do case 9 stuff

    Case 3

    'do case 3 stuff

    Case 9

    'do case stuff

    Case else

    End select

     

    Does anyone else remember this type of behavior from the past?  Did the same type of behavior exist in the past for the Switch statement in C or was this a "feature" of the VB3-6 runtime?