c# - Getting the content of the cell of a selected row from DataGridView -


this question has answer here:

string feeid = grdvw.rows[index].cells[0].text; 

is correct way retrieve content of cell in selected row? if use this, not value. so, please suggest best way.

yes, that's way it, can like:

string feeid = grdvw.rows[index].cells[0].value; 

also, if want values rows iterate through datagridview this:

foreach (datagridviewrow row in grdvw.rows) {    string column0 = row.cells[0].value;    string column1 = row.cells[1].value;    //more code here } 

Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -