Click here to Skip to main content
15,896,730 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
If there is no data in the datagridview and still I select the empty cell and click on update, I am getting message as updated. but if I click on update directly then I get "There are no records to update". My requirement is if there is no data in the datagrid view and even though we click on the empty cell, it should not get update message. the code I am using is:
C#
if (dataGridView2.SelectedCells.Count == 0 )

           {
               MessageBox.Show("There are no any records to update");
           }
Posted
Comments
Thanks7872 24-Sep-13 6:28am    
If there is no data than there won't be empty cell. I think question needs some more clarification on what you are trying to do.
karthik reddy mereddy 24-Sep-13 6:36am    
it is a datagridview, even though there is no data in the datagridview, we can select the cells.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900