2009-03-25 6 views
4

내가 가진 오류 나는 BindingSource에두 번째로 DataBinding이 작동하지 않는 이유는 무엇입니까?

의 데이터 소스를 변경할 때

 this.RemoveAllBindings(); // My work-around for the meantime 

     bdsOrder.DataSource = _ds.Tables["orders"]; // errors here on second time around(first time is blank datatable, second time is when i open existing record, then it errors), dataset comes from Remoting 
     bdsOrderDetail.DataSource = _ds.Tables["order_detail"]; 

     bdsPhoto.DataSource = _ds.Tables["order_photo"]; 
     bdnPhoto.BindingSource = bdsPhoto; 

내 도우미 확장 메서드 "모든 바인딩이 그것을 행하기에 적합한 행을 찾을 수없는 데이터 바인딩 모든 바인딩에 적합하다"워크 "데이터 바인딩이 행을 찾을 수 없습니다 ..."라는 오류가 발생했습니다. 모든 가능한 경우

namespace MycComponentExtension 
{ 
    public static class Helper 
    { 
     public static void RemoveAllBindings(this Form form) 
     { 
      RemoveAllBindings((Control)form); 
     } 

     private static void RemoveAllBindings(this Control root) 
     { 
      foreach (Control c in root.Controls) 
      { 
       if (c.Controls.Count > 0) RemoveAllBindings(c); 

       root.DataBindings.Clear(); 
      } 
     } 

, 나는 내 작품 - 주위에 "데이터 바인딩 행을 찾을 수 없습니다 ..."오류의 의미는 무엇 제거 할 수 있어요?

답변

3

DataGridView가 관련되어 있지 않지만 데이터 소스가 다른 스레드 (못된!)에서 업데이트되고 제 바인딩에 FormattingEnabled = false가있을 때이 오류가 발생했습니다. 이 두 가지를 변경하면 문제가 해결 된 것 같습니다.

+0

'FormattingEnabled = true'는 마 법적으로 "모든 바인딩에 적합한 목록에서 데이터 바인딩이 행을 찾을 수 없습니다." "InvalidOperationException'을 피하는 것 같습니다. – binki

관련 문제