Datagridview: got the row value now need the string value
-
I know a lot of people ask how to get the row index value in a C# datagridview so this code should help them. But I am now stuck. The data source is created on the fly and is destroyed as soon as it is viewed so I have to retrieve data from the visible datagrid view: I need to get the string value of my known (row, column). Googling and going through the IDE has been no help. How do I do this?
int i = adObjectDataGridView.CurrentRow.Index; MessageBox.Show(Convert.ToString(i)); //adObjectDataGridView.//need string value of known row, column
shwa guy -
I know a lot of people ask how to get the row index value in a C# datagridview so this code should help them. But I am now stuck. The data source is created on the fly and is destroyed as soon as it is viewed so I have to retrieve data from the visible datagrid view: I need to get the string value of my known (row, column). Googling and going through the IDE has been no help. How do I do this?
int i = adObjectDataGridView.CurrentRow.Index; MessageBox.Show(Convert.ToString(i)); //adObjectDataGridView.//need string value of known row, column
shwa guyif you know row# = i, and column# = n, try:
adObjectDataGridView.Rows[i].Cells[n].Value.ToString()
-
if you know row# = i, and column# = n, try:
adObjectDataGridView.Rows[i].Cells[n].Value.ToString()
-
no problem!