Datagrid Value Read & Playback

Hey guys, this is a windows application built in C#. I am using the datagrid tool and populating it with employee information. The grid ends up with 5 columns and a variable amount of rows.

I want to select a row of data in the grid, then click a button on the form and have it:
messagebox.show( cell content of the first cell/column in the selected row )  

The first column is actually the UserID, and I want to be able to retrieve that ID for pushing the info into another stored procedure.
LVL 1
ProWebNetworksAsked:
Who is Participating?
 
ProWebNetworksAuthor Commented:
Found it :)
            int SelRow = Convert.ToInt32( dgActiveUsers.SelectedCells[0].RowIndex.ToString());
            MessageBox.Show(dgActiveUsers.Rows[SelRow].Cells[0].Value.ToString());

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.