blah blah blah is here! blah blah » Close

up1down
link

How can i close my form if my datagrid has no rows? or rows with any data anyhow. I'm going to place the code in a timer event.

So basicly when my timer event fires if it doesn't count any rows in DataGridview the form will close.

last answered one year ago

1 answers

link

If your DGV always has a blank line at the end for adding new rows, then there will always be at least 1 row but you could try:

if (dataGridView1.Rows.Count == 1) this Close();

I never thought it would be that simple, thanks vulpes.

Feedback