Datagridview: is not empty?

Opprend

Member
Joined
Nov 5, 2013
Messages
8
Programming Experience
Beginner
How to write this statement: ?

If datagridview1 is not empty then
....
End if

Thank you.

Edit:
My apologies. I posted in the wrong forum.
This is my second mistake.
I'll make sure not to remake it again.
 
Last edited:
Hi,

You can check the Rows.Count property of the DataGridView to check if you need to do something with it. i.e:-

Assuming that you have a header and you allow adding new rows then you can say:-
If DataGridView1.Rows.Count > 1 Then
    'This means that the DataGridView Has Some Rows, so do something
End If


Hope that helps.

Cheers,

Ian
 
Last edited:
Back
Top