c# - How do I retrieve data from cell of selected row in datagridview? -
i have datagridview
7 columns, column 0 , 1 not visible. column 0 id column. when select row
value in column 0
. once have value, can delete row data table
. deleting row datagridview
not problem.
this line returns row index
no problem;
int rowindex = customer_ship_contactsdatagridview.selectedrows[0].index;
then research appear line data column 0
of selected row
. not. error states "when converting string datetime, parse string take date before......"
int contact_id = int.parse(customer_ship_contactsdatagridview[0, rowindex].value.tostring());
any teaching me how value of column
tostring
selected row of datagridview
appreciated.
i have found answer in post get value in specific column in datagridview. not sure why didn't find last night except today simplified search , came across post. sorry trouble may have caused, using site help.
datagridviewrow row = customer_ship_contactsdatagridview.currentcell.owningrow; string contact_id = row.cells["contact_id"].value.tostring();
Comments
Post a Comment