Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Exit Function

Posted on 2006-06-12
3
Medium Priority
?
4,726 Views
Last Modified: 2012-06-21
Can anyone give me the equivalent command for Exit Function or Exit Sub in C#?

Regards
Pradeep
0
Comment
Question by:pradeepsudharsan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 100 total points
ID: 16891970
Use "return"...

        private void button1_Click(object sender, EventArgs e)
        {
            Debug.WriteLine("the code below");

            return;

            Debug.WriteLine("will never be reached...");
        }
0
 
LVL 7

Author Comment

by:pradeepsudharsan
ID: 16891983
any other command?
0
 
LVL 5

Accepted Solution

by:
t_itanium earned 100 total points
ID: 16892268
yes you can do that by another way around :)

 private void button1_Click(object sender, EventArgs e)
{
            MessageBox.Show("it is displayed");

            goto end;

            MessageBox.Show("it is not displayed");

            end: {}
 }

when reaching the goto function it will go to the end of the function and end it...

cheers
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question