Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

DataTable ColumnChanged Not Working

$
0
0

Hi, i am trying to get the columnchanged event handler to work in a datatable.

I have created a DataTable Added column 

Added Row

then I connected it to DataGridView via DataSource

When I Type Something in DataGridView Column And it Updates DataTable I Want The event handler to fire

What am I doing wrong?

here is a stripped down version of my code:

 namespace Orbital_Rivet_Machine
{
    public delegate void UpdateActiveOrders();
    public partial class Orders : UserControl
    {

        public UpdateActiveOrders CCUpdateActiveOrders;

DataTable DtActiveOrder = new DataTable();

private void Orders_Load(object sender, EventArgs e)
        {

            DtActiveOrder.Columns.add("QtyDone",typeof(string));

    DtActiveOrders.Rows.Add();

    DGVActiveOrders.DataSource = DtActiveOrder;

           DtActiveOrder.ColumnChanged += DtActiveOrder_ColumnChanged;
        }

        

private void DtActiveOrder_ColumnChanged(object sender, DataColumnChangeEventArgs e)
        {
            if(CCUpdateActiveOrders!=null)
            {
                CCUpdateActiveOrders();
            }
        }

    }

}


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>