Coffeehouse Post

Single Post Permalink

View Thread: Select Case behavior
  • User profile image
    ScanIAm

    @xgamer:

    I recently came up against a _bug_ in VB.Net where this didn't seem to do what I wanted it to:

    Select Case X
        Case 1
        Case 2
        Case 3
            Consol.WriteLine("hit")
    End Select

    I spent far too much time trying to figure out why Console.WriteLine("hit") was skipped when X was 1.  Any moderately seasoned VB developer can probably figure out pretty quickly, but I'm from the C world...

    This worked much better:

    Select Case X
        Case 1,
        Case 2,
        Case 3
            Consol.WriteLine("hit")
    End Select

    I'll admit that VB.Net is a complete .Net language, but I'm a bit tired of tracking down stupid syntax bugs...