Hi,
To reproduce problem just add 3 columns to grid and paste code below to Load event.
Even if we apply the condition that checks divide by zero, program will trow error:
A first chance exception of type 'System.DivideByZeroException' occurred in mscorlib.dll
I was able to fool the "Expression" by double condition like this:
To reproduce problem just add 3 columns to grid and paste code below to Load event.
private void Form1_Load(object sender, EventArgs e){ DataTable dt = new DataTable(); dt.Columns.Add("d1", typeof(Decimal)); dt.Columns.Add("d2", typeof(Decimal)); dt.Rows.Add(new object[] { 3, 4 }); dt.Rows.Add(new object[] { 1, 4 }); dt.Rows.Add(new object[] { 0, 3 }); dt.Rows.Add(new object[] { 3, 3 }); radGridView1.Columns[0].FieldName = "d1"; radGridView1.Columns[0].HeaderText = "d1"; radGridView1.Columns[0].Name = "d1"; radGridView1.Columns[1].FieldName = "d2"; radGridView1.Columns[1].HeaderText = "d2"; radGridView1.Columns[1].Name = "d2"; radGridView1.Columns[2].HeaderText = "exp"; radGridView1.DataSource = dt; radGridView1.Columns[2].Expression = "IIF(d1 = 0, 0, d2 / d1 )";
}
Even if we apply the condition that checks divide by zero, program will trow error:
A first chance exception of type 'System.DivideByZeroException' occurred in mscorlib.dll
I was able to fool the "Expression" by double condition like this:
radGridView1.Columns[2].Expression = "IIF(d1 = 0, 0, d2 / (IIF(d1 = 0, 9999 , d1)))";