2012-08-14 5 views
0

데이터베이스의 데이터를로드하여 FormLoad의 DevExpress TextEdit 컨트롤에 배치하기 때문에 이벤트 처리기 TextEdit_EditValueChanged가 호출됩니다. 이벤트 처리기를 검사하거나 이벤트가 발생하지 않도록 할 수 있습니까? 이 같은양식로드시 editValueChanged를 호출하지 않음

+1

우리가 할 수있는 몇 가지 코드 plz? – elyashiv

답변

4

뭔가 :

bool dataLoaded = false; 

private void LoadData() 
{ 
    // do the loading and set the Text property of the textEdit 
    dataLoaded = true; 
} 

private void TextEdit_EditValueChanged(object sender, EventArgs e) 
{ 
    if (dataLoaded == false) return; 
    // the code after this comment will run only after the data was loaded 
} 

또는 로딩이 다음과 같이 수행 한 후 이벤트 핸들러를 추가 할 수 있습니다

private void LoadData() 
{ 
    // do the loading and set the Text property of the textEdit 
    TextEdit.EditValueChanged += TextEdit_EditValueChanged; 
} 

private void TextEdit_EditValueChanged(object sender, EventArgs e) 
{ 
    // the code after this comment will run only after the data was loaded 
} 
0

사용 속성

private void TextEdit_EditValueChanged(object sender, EventArgs e) 
{ 
    if (!this.IsLoaded) return; 
    // the code after this comment will run only after the data was loaded 
} 
관련 문제