Topic: Help for my division please
Hello everyone, I'm trying to do a division for my son but I find an error and I don't know where it comes from.
Can anyone help me?
My Visual Database → General → Help for my division please
Hello everyone, I'm trying to do a division for my son but I find an error and I don't know where it comes from.
Can anyone help me?
Hello everyone, I'm trying to do a division for my son but I find an error and I don't know where it comes from.
Can anyone help me?
frmOperation.edTotalDivision.Value := frmOperation.edDivision1.Value / frmOperation.edDivision2.Value;
Hi,
if frmOperation.edDivision2.Value <> 0 then
frmOperation.edTotalDivision.Value := frmOperation.edDivision1.Value / frmOperation.edDivision2.Value
else ShowMessage('You cant divide by 0.');
Super, Merci a vous deux, ca fonctionne très bien. Vous êtes des chefs.
Bizzz
Hi Sabine,
In your attachment, I noticed that you have procedures 'frmoperation_edDivision1_OnChange' and 'frmoperation_edDivision2_OnChange' and both procedures then call your own procedure 'calculatetotaldivision'. So, in effect, your script has 3 procedures.
Instead of using the procedure name that is automatically generated by MVD, you can just enter your own procedure name and then double-click to create it in the script.
So, 1 procedure instead of 3 which makes the script both more compact and more readable.
However, the real bonus is that you can also use your own procedure on many different objects.
Perhaps the attachment will illustrate better the point - instead of 6 separate procedures for the 6 edit 'onchange' events that all then call the 7th procedure (to calculate everything), it can be done just with 1 procedure. Notice how the 'onchange' event for all 6 edit fields is the same - 'calculatetotal'
Maybe this helps,
Derek.
Hi Sabine and Hi Derek )
Sabine, I would recommend adding a divide-by-0 check like the example I posted. But of course this is optional.
And the restriction on entering only numbers.
Exactly the program only concerns numbers and it gives me an error when I apply it.
My Visual Database → General → Help for my division please
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi