meyerc74
asked on
looping through datagrid rows and updating columns
i have a system.windows.forms.datag rid in which i want to loop through the rows. while looping i need to get the value of two columns and update a third column.
the datagrid datasource is a dataTable set at startup.
not to sure how to do this, can anyone get me started or point me in the right direction, thanks
the datagrid datasource is a dataTable set at startup.
not to sure how to do this, can anyone get me started or point me in the right direction, thanks
ASKER
i'm building a windows application using system.windows.forms.datag rid
oh, sorry. i haven't used the data grid much. we used a 3rd party grid. i'll see if i can find some time to help you figure this out.
ASKER
ok...i found if i set my DataTable as a class member(rather than a local function var) i can loop through the DataTable rows, update and then reset the DataSource of my datagrid.
while this does do what i need it to do, it seems horribly inefficent, and i would prefer to do each row individually so the end user can see at any giving time which row is currently being processed.
while this does do what i need it to do, it seems horribly inefficent, and i would prefer to do each row individually so the end user can see at any giving time which row is currently being processed.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
excellent...thank you. the visibleRowCount worked. probably should have seen that myself, but we live and learn :)
thanks again
thanks again
no problem.
it wasn't very intuitive, and it brings up a question: if i have hidden columns or rows, would that throw things off? or are the hidden ones inaccessible?
glad i could help.
it wasn't very intuitive, and it brings up a question: if i have hidden columns or rows, would that throw things off? or are the hidden ones inaccessible?
glad i could help.
the Items property of the grid correlates to the rows, and the Cells property of the item correlates to the cells in the row.
datagrid.Item[0].Cells[3] is the first row, forth cell.