Hi, i think a better apporch is to check that the user have filled the data correctly in the begining.
To check if the datagridview contains valid data you may use somthing like this:
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if (row.Cells[1].Value.toString()) == "")
{
}
}
I am totaly against using this kind of solution. the best way is to create a class and then affect the class to the datagrid.
your will then work only with lists. much easier, faster and efficient.
Foreach(User user in userList)
{
if(user.Name == null || user.Name == "")
{
}
}
Hope you will consider using the second solution.
Hope it helps.