Solved

Exit Function

Posted on 2006-06-12
3
4,722 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 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 25 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 25 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project

749 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