[Solved] How to make my program(exe) to stop(and not exit) once an event(generation of a text file) has occured?


Within your class It can be placed in two functions and called from the if – else logic or you can place the code in between the if and else. If the code is large then it would be better to create two functions.

If (condition)
   call function step1
else
   call function step2

or 

if (condition)
  code...
else
  code...

C# Example of defining a method and calling it:

    public void Caller()
{
    int numA = 4;
    // Call with an int variable. 
    int productA = Square(numA);

    int numB = 32;
    // Call with another int variable. 
    int productB = Square(numB);

    // Call with an integer literal. 
    int productC = Square(12);

    // Call with an expression that evaulates to int.
    productC = Square(productA * 3);
}

int Square(int i)
{
    // Store input argument in a local variable. 
    int input = i;
    return input * input;
}

3

solved How to make my program(exe) to stop(and not exit) once an event(generation of a text file) has occured?