1

i am binding my windows form from binding source. i am performing one event when the user search any employee on another form and double click i take the id from there and fill the parent form . But before fill the form i want to check is the bindingsource is in edit or add mode . If the binding source is in add or edit mode then i will popup message to save the data that is in edit or insert mode . So how can i know the binding source is in edit or insert mode .

 private void tsbtnEmpSearch_Click(object sender, EventArgs e)
     {
       if (_context == null)
       _context = new ATSdbEntities();
       EmpSearch empsear = new EmpSearch();
       empsear.ShowDialog();
       int SearchEmpId = empsear.searchEmpid;
       // Here i want to check is the employeesBindingSource
       // Is not in Insert or edit mode     

    if (SearchEmpId > 0)
       {
       SJM.Comet.Employee eu = _context.Employees.Where(d=>d.EmpId==SearchEmpId).SingleOrDefault();
       int empIndex = employeesBindingNavigator.BindingSource.IndexOf(eu);
       employeesBindingNavigator.BindingSource.Position = empIndex;
        }
      }   

Thanks for your cooperation .

Abhishek
  • 319
  • 8
  • 23

0 Answers0