Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all,

I need a loop that can run trew every row of my datagridview
(Number of rows alsways diffrent when grid populates)

string IP;
int rowno = 0;
...
for(...)
{
IP = dgvMeterDetails["MeterID", rowno].Value.ToString();
rowno = rowno +1;
}


Please any help would be appriciated
Posted

Try:
C#
foreach (DataGridViewRow row in dgvMeterDetails.Rows)
    {
    ...
    }
 
Share this answer
 
see the colourchange() example here[^]. It iterates over a datagridview
 
Share this answer
 

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