• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

c# 2005 Datagrid

Trying to loop through the selected rows in a datagrid, showing the 1st field if each row of it....


I tried Currencymanager, but no luck.....


any ideas...

0
bman9111
Asked:
bman9111
2 Solutions
 
anyoneisCommented:
Is DataGridView OK?  Youy can get the indices of the selected rows like this:

        private void button1_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow dgvr in dataGridView1.SelectedRows)
            {
                Console.WriteLine(dgvr.Index);
            }
        }

Then, use those indices against the DataSource.

David
0
 
MuhammadAdilCommented:
private void button1_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow dgvr in dataGridView1.SelectedRows)
            {
                Console.WriteLine(dgvr.Cells[0].value.toString());
            }
        }
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now