"OC" <nf*@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
What would be the best way to check for a decimal number coming in as, for
example, 99999.9999 and truncating it to 99999.99?
IOW, if it is 4 digits after the decimal, truncate it to 2.
You could probably fiddle around with string formatting, but for most
decimal numbers, this should work fine:
decimal dec = 99999.9999M;
dec = Decimal.Truncate(dec * 100) / 100;
MessageBox.Show(dec.ToString());
Erik