Click here to Skip to main content
15,894,410 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my form has datagridview.I want to get the maximum value from datagridview specific column.If it is Possible how to do it

Please help me

Thank you
Posted
Updated 9-Jan-12 1:13am
v2

Or, if you are binding DataTable to your GridView than you can use DataTable's Compute Method

http://msdn.microsoft.com/en-us/library/system.data.datatable.compute.aspx[^]

http://www.mindfiresolutions.com/DataTable-Compute-Method-628.php[^]
 
Share this answer
 
Comments
devausha 9-Jan-12 7:47am    
Thank you very much
I am so happy
Suresh Suthar 9-Jan-12 7:50am    
Glad that this helped you.
VB
Dim MaxVal as Double = 0
For Each row As DataGridViewRow In DataGridView1.Rows
   If row.Cells(0).Value > MaxVal Then MaxVal = row.Cells(0).Value 'Maximum value of first column
Next
 
Share this answer
 
v2
Comments
vherway 30-Nov-13 2:00am    
Hello.. I have been trying your code. And that work!
But, how to get the Minimum Value??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900