Hey there.

I was wondering if it was possible to stop execution at a certain point without closing the Program?

For example

Private some button is clicked

code
code
code
code
But here i want execution to stop as the user did something wrong
code
code
code
code

I have a Form1, So when the execution stops, the Form1 should still be showing

Thank you
Ruan

Recommended Answers

All 2 Replies

Use return statement.

public void test()
{
   //code
   if(test_your_condition)
      {
         return;
       }
   //code
}

Use return statement.

public void test()
{
   //code
   if(test_your_condition)
      {
         return;
       }
   //code
}

That works perfectly, Thank you =)
Hava great day.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.