Input Validation Using Flow Abort Exception

In this page we'll:

  • Use the FlowAbortException to prevent the user from leaving the Controller
protected override void OnSavingRow()
{
    if (Orders.OrderDate.Year < 1990)
    {
        System.Windows.Forms.MessageBox.Show("Invalid Year");
        throw new Firefly.Box.Advanced.FlowAbortException();
    }
} 
  • Use ENV.Message.ShowError to show a message and throw the exception in one line
protected override void OnSavingRow()
{
    if (Orders.OrderDate.Year < 1990)
    {
-       System.Windows.Forms.MessageBox.Show("Invalid Year");
-       throw new Firefly.Box.Advanced.FlowAbortException();
        Message.ShowError("Invalid Year");
    }
} 
  • Explain how to determine if Visual Studio should switch to the code when this exception happens


Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com