I have a datagridview like attachment. How can I find the ten biggest and ten smallest numbers in column A, and write them in column B. (from the first cell)
Thanks a lot.
Copy the values to a temporary numeric array (not a String array). It may be easier to copy from the original data source rather than from the DataGridView cells; depends on how you originally populated the DGV.
Use the Array.Sort method on the temporary array and pick the first ten and last ten values from the sorted array.
OK. May be a solution but not for me I think. Because, I will add new row cell everyday. And if you think that I have many columns like that it will be very hard to do same everyday.
Thank you very much for your answer.
In my opinion we can solve this problem in that way. Look at the first cell of the first column. Its value is 9 and Its address is ***DataGridView1.Rows(0).Cells(0).Value****. The last cell value is 7,55 and its address is ***DataGridView1.Rows(43).Cells(0).Value****. So, if it is possible to find where the first empyt cell is in the first column (let say between DataGridView1.Rows(0).Cells(0).Value and DataGridView1.Rows(220).Cells(0).Value) , it will be easy to write the code for upper cells and to calculate the average.
In my opinion we can solve this problem in that way. Look at the first cell of the first column. Its value is 9 and Its address is ***DataGridView1.Rows(0).Cells(0).Value****. The last cell value is 7,55 and its address is ***DataGridView1.Rows(43).Cells(0).Value****. So, if it is possible to find where the first empyt cell is in the first column (let say between DataGridView1.Rows(0).Cells(0).Value and DataGridView1.Rows(220).Cells(0).Value) , it will be easy to write the code for upper cells and to calculate the average.