Hi all,
In my project I get data from a database into a DGV then I loop down a column of figures(student marks) to find an average.The average figure is then placed into a textbox.Here is an example code
Code:
Dim sum as double
Dim d as single
On Error Resume Next
  For q=0 to 5
    sum +=
   DataGridView1.Rows(g).Cells("marks").Value()
On Error Resume Next
Next
It works fine but the problem is with the display of the number in the texboxes.I am trying to get it down to two decimal places,something like this:
21.23
or beter still this
21.3
however I am getting this
21.3333333333 etc
I have treid a few things like changing the format of the column in the database,but it doesn't work.I cant find anything in the TB properties either
Any suggestions much appreciated
cheers
al