Users Pricing

forum

Home Forums How to get the First Column Values of Selected Rows of DataGridView in C#? – MindStick

How to get the First Column Values of Selected Rows of DataGridView in C#?

Anonymous User 9913 14 Nov 2013

I am using the below code to get the ID of columns :

DataGridViewSelectedCellCollection DGV =this.dgvSearch.SelectedCells;
for (int i = 0; i <= DGV.Count - 1; i++)
{
string ID = Convert.ToString(dgvSearch.CurrentRow.Cells[0].Value);
MessageBox.Show(ID);
}

I am getting the ID but I want it once foe each column.

How to do it?


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md