checking if gridview is empty using c#
Currently i have the following:
if (dataGridView1.Rows.Count == 0)
{
MessageBox.Show("EMPTY");
}
else
{
using (var soundPlayer = new SoundPlayer(@"c:\Windows\Media\chimes.wav"))
{
soundPlayer.Play(); // can also use soundPlayer.PlaySync()
}
}
My grid view looks like this:
But it seems to go to the else statement and make the sound. I need it to
NOT make a sound if there is no data in the rows of the gridview.
No comments:
Post a Comment