Borkan
Borkan

Reputation: 29

How to Check if DatagrGridView has a new row c#

Hi guys I was wondering how can I check if DataGridView has a new row when i click on Add Button. Note that, I'm using BindingManagerBase to bind DataGridView with TextBoxes. I tried this code :

        bool Is_Empty = false;
        for (int i = 0; i < dataTable.Columns.Count; i++)
        {
            if (dataTable.Rows[dataTable.Rows.Count - 1].IsNull(i))
                Is_Empty = true;
        }

        if (Is_Empty == false)
            BindingManagerBase.AddNew();

Upvotes: 0

Views: 72

Answers (1)

Ehsan K. harchegani
Ehsan K. harchegani

Reputation: 3128

you can use rowsAdded event. here is the example

Upvotes: 1

Related Questions