Handling the "Division by 0" exception in .NET

2018-11-05

Among the updates in FastReport 2018.4, there was a solution to the dividing by zero error. Previously, report developers had to handle this exception themselves. After all, we cannot guarantee that because of the data this error will not occur. If you have not done the division by zero processing, you will get an exception that will interrupt the construction of the report. As a result, you still have to refine the report, and this is an additional time cost.

Now, you do not need to think about this problem, in the expression where the division error by zero occurred, the message “Division by zero” will be displayed. In this case, the report is constructed. Let's compare what was and what has become when divided by zero.

Add a text field to the report and enter the following expression: [2018/0]. These are two integers.

That's what how it was in previous versions of FastReport .NET. When trying to run a report in the designer:

When running a report from a user application:

As it has become:

 

The report was constructed, but the field with an error is highlighted with a red background, replaced by the text DIVISION BY ZERO!

It works on integer values. And what if you divide numbers with a comma by zero? For example, the expression [2018.0 / 0.0] will give the result:

 

This works in the previous version and in the new one.

Thus, the built-in processing of division by zero freed us from the "headache" - to write our own handlers in the report script. So, the development of reports has become even easier and more convenient.

.NET FastReport
27 Kasım 2026, Cuma

FastReport .NET'te Data Dictionary Nasıl Kullanılır

FastReport .NET'teki Veri Sözlüğü'nü (Data Dictionary) keşfedin: rapor verilerini yapılandırılmış şekilde yönetmek için bir araç. Sözlükleri kullanıcı arayüzü üzerinden oluşturmayı, kaydetmeyi ve birleştirmeyi; ayrıca Load, Save ve Merge yöntemleriyle programatik olarak yönetmeyi öğrenin. Adım adım bir örnek ve C# kod örnekleri dahildir.
26 Kasım 2026, Perşembe

FastReport .NET ve FastReport VCL'de PDF417 Barkodu Oluşturma

FastReport .NET ve VCL'de PDF417 barkodunun nasıl oluşturulacağını öğrenin: ISO/IEC 15438 formatı, tasarımcı ayarları ve C# ile Delphi kod örnekleri.
25 Kasım 2026, Çarşamba

NativeAOT .NET'te: JIT ve Reflection.Emit olmadan dinamik C# betiklerini çalıştırma

NativeAOT'ta JIT ve Reflection.Emit olmadan C# betikleri çalıştırma: FastScript.NET, AOT uygulamalarında esnek iş mantığı için AST tabanlı yorumlayıcı.

© 1998-2026 Fast Reports Inc.