Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

c# Math.Max not returning results.

$
0
0

I want to get the Max value between 2 numbers, if they are the same return that values.

Each line in debug shows a value. except for d3 where the value should be placed after it determines the highest value.

Ideas of what I'm doing wrong?

decimal d1 = decimal.Parse(string.IsNullOrEmpty(rows.Cells[41].Value.ToString()) ? "0" : rows.Cells[41].Value.ToString());
                decimal d2 = decimal.Parse(string.IsNullOrEmpty(rows.Cells[46].Value.ToString()) ? "0" : rows.Cells[46].Value.ToString());
                decimal d3 = decimal.Parse(string.IsNullOrEmpty(rows.Cells[37].Value.ToString()) ? "0" : rows.Cells[37].Value.ToString());
                decimal AL = Math.Max(d1, d2);
                AL = Math.Max(d3,AL);


Booney440


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>