Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

c# select only the first column of a datagridView

$
0
0
I have a datagridview that i am trying to select only the first column of a row that i have clicked on.

When i currently click on the datagridView i get the value that i have clicked on returned. The code for this is as follows
string supplierCode1 = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();


How would i alter the above so i only select the first column of the row even if i click on column 1,2,3,4

I have tried to change the value of .Cells with no avail.

regards Inkey

Viewing all articles
Browse latest Browse all 51036

Trending Articles