Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4728
  • Last Modified:

Exit Function

Can anyone give me the equivalent command for Exit Function or Exit Sub in C#?

Regards
Pradeep
0
pradeepsudharsan
Asked:
pradeepsudharsan
2 Solutions
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Use "return"...

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

            return;

            Debug.WriteLine("will never be reached...");
        }
0
 
pradeepsudharsanAuthor Commented:
any other command?
0
 
t_itaniumCommented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now