How to tell if user has modified data using bindingsource?

后端 未结 12 2177
南方客
南方客 2021-01-05 06:05

I have a DataGridView bound to a bindingsource which is bound to a List. The user clicks a row that goes to a form with textboxes, etc. The textboxes a

12条回答
  •  情深已故
    2021-01-05 06:32

    If your bindingsource uses a datatable you can do this :

        public bool HasChanges()
        {
            bool Result = false;
    
            myBindingSource.EndEdit();
            Result = ((DataTable)myBindingSource.DataSource).GetChanges(DataRowState.Modified) != null;
    
    
            return Result;
        }
    

提交回复
热议问题