Ari

Ari

  • NA
  • 8
  • 50.1k

How to check if a selected row in a datagridview is empty(has no item)

Nov 4 2011 4:21 AM
Hey! First time poster here, first of all I wasn't sure if this is the right place to post but, how would I accomplish this? I've been trying the following:

            if (dgvClient.SelectedRows.Count > 0)
            {
                DataGridViewRow currentRow = dgvClient.SelectedRows[0];
                if (currentRow.Cells.ToString() != String.Empty)
                {
                    //The code that will be here will open a form
                }
                else
                {
                    MessageBox.Show("Select a non null row");
                }
            }

However, it doesn't appear to be working, and I'm out of ideas :/

Thanks for any help, 
Ari

Answers (3)