I have a datagridview
with 7 columns, column 0 and 1 are not visible. Column 0 is the ID column. When I select a row
I would like to get the value in Column 0
. Once I have the value, I can then delete the row from the data table
. Deleting the row from the DataGridView
is not a problem.
This line returns the row index
with no problem;
int rowIndex = customer_Ship_ContactsDataGridView.SelectedRows[0].Index;
Then with all my research it would appear that this line would get the data from column 0
of the selected row
. But it does not. I get an error that states "When converting a string to DateTime, Parse the string to take the date before......"
int contact_ID = int.Parse(customer_Ship_ContactsDataGridView[0, rowIndex].Value.ToString());
Any help with teaching me how to get the value of a column
toString
from the selected row of a DataGridView
would be greatly appreciated.