Hi Chris,
That worked of course, many thanks, uh duh I also realised that I had the
formula round the wrong way it should have been:
perDayCount = (budgetTotal.BudgetCount / _daysInMonth);
It is working out the budget for less than a whole month, which the budgets
are based on, so I was trying to work out the per day count and then I
multiply that by the number of days in the month selected, but the original
way round wasn't right anyway, but now it is and it works so thanks again
Colin
--
Colin Basterfield
Off the Roof Solutions
"Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
"Colin Basterfield" <co**************@hotmail.com> wrote in
news:eX**************@TK2MSFTNGP09.phx.gbl:
Hi there,
I have come back to C# from a Delphi project and got myself
stuck with a simple division.
I have the following expression
perDayCount = (_daysInMonth / budgetTotal.BudgetCount);
where
perDayCount is float
_daysInMonth is int
budgetTotal.BudgetCount is short
now the values for one of the rows in my set are
_daysInMonth = 30
budgetTotal.BudgetCount = 300
Now I want 0.1 out which is the answer of course but perDayCount
comes out at 0.0 each time, which causes my next calc to fail.
Can anyone put me out of my misery please?
Colin,
Cast the integers to floats to make the calculation work:
perDayCount =
((float) _daysInMonth / (float) budgetTotal.BudgetCount);
--
Hope this helps.
Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/