For j = 0 To DataGridView1.Rows.Count - 1 For i = 2 To DataGridView1.Columns.Count - 5 tot = tot + DataGridView1.Rows(j).Cells(i).Value If DataGridView1.Columns(i + 1).Name = "Total" Then DataGridView1.Rows(j).Cells(i + 1).Value = tot DataGridView1.Columns(i + 1).ReadOnly = True k = i End If Next DataGridView1.Rows(j).Cells(k + 2).Value = Math.Truncate(tot/k* 10) / 10 ' DataGridView1.Rows(j).Cells(k + 2).Value = tot / k DataGridView1.Columns(k + 2).ReadOnly = True tot = 0
DataGridView1.Rows(j).Cells(k + 2).Value =(Math.Floor( Math.Truncate(tot/k* 10) / 10).ToString();' DataGridView1.Rows(j).Cells(k + 2).Value = tot / k
DataGridView1.Rows(j).Cells(k + 2).Value = Math.Round(Math.Round(tot/k* 10) / 10).ToString()
'To get without round up Dim d As Decimal = 78.9 Dim i As Integer = Convert.ToInt32(d) 'this code will give with round up Dim d1 As Decimal = 78.9 Dim j As Integer = Math.Round(d1)
Thanks & RegardsG.RenganathanNothing is mine ,Everything is yours!!!