Results 1 to 7 of 7

Thread: Might be a stupid question but...

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    34

    Question

    I was wondering if its possible to break out of an event. I mean I have an event that happens and after certain criteria are met I want to break out of the event without executing the rest of the code. I know break is a keyword in some programming languages and I was wondering if theres something like it in VB.

    Any response would be appreciated, thanks,
    Wick

  2. #2
    Lively Member Jamagei's Avatar
    Join Date
    Jul 2000
    Location
    running from you. You freak.
    Posts
    69
    exit sub

    would do it, i think!
    Now, aren't you sorry you didn't just keep on scrolling?

  3. #3
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    Just use Exit Sub.

  4. #4
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    Doh!

    Not quick enough.

  5. #5
    Lively Member Jamagei's Avatar
    Join Date
    Jul 2000
    Location
    running from you. You freak.
    Posts
    69
    ha haa

    p.s just ignore the signature
    Now, aren't you sorry you didn't just keep on scrolling?

  6. #6

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    34

    Lightbulb

    Thanks guys, it must be early in the morning for me...DUH!

  7. #7
    Addicted Member
    Join Date
    Feb 2000
    Posts
    224
    There are many EXITS depending from where you would like to exit..

    Exit Do
    Exit For
    Exit Function
    Exit Property
    Exit Sub


    Exit Do Provides a way to exit a Do...Loop statement. It can be used only inside a Do...Loop statement. Exit Do transfers control to the statement following the Loop statement. When used within nested Do...Loop statements, Exit Do transfers control to the loop that is one nested level above the loop where Exit Do occurs.

    Exit For Provides a way to exit a For loop. It can be used only in a For...Next or For Each...Next loop. Exit For transfers control to the statement following the Next statement. When used within nested For loops, Exit For transfers control to the loop that is one nested level above the loop where Exit For occurs.

    Exit Function Immediately exits the Function procedure in which it appears. Execution continues with the statement following the statement that called the Function.

    Exit Property Immediately exits the Property procedure in which it appears. Execution continues with the statement following the statement that called the Property procedure.

    Exit Sub Immediately exits the Sub procedure in which it appears. Execution continues with the statement following the statement that called the Sub procedure.
    Remarks

    Do not confuse Exit statements with End statements. Exit does not define the end of a structure.

    - Courtesy : Microsoft VB HELP File


Posting Permissions

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



Click Here to Expand Forum to Full Width