Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2002
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Visual Basic Qns on "Select Case"

    hi! do anyone know whether how to break out from a select case?

    thanks!

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Well I'm not sure how if you wished it to continue running code that was past the select block. But if you didn't want to run any code in the sub past the block statement, you could just use 'Exit Sub'

    Maybe there is a 'Exit Select'? I know there is an 'Exit Do'

  • #3
    New Coder
    Join Date
    Oct 2002
    Location
    nj
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There is no KEYWORD to exit from the Select Case, however calling a function within the Case statement, is almost the same as exiting, for example:

    Dim I
    I=2
    select case I
    case 1
    DisplayMsg("Apple")
    case 2
    DIsplayMsg("Banana")
    case else
    DisplayMsg("Orange")
    End Select

    Function DisplayMsg(s)

    Msgbox s

    End Function


    Thanks,
    Ray

  • #4
    New Coder
    Join Date
    Sep 2002
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for your help..is really useful


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •