2011-05-12 107 views
0

我在vs2010專業版中創建了一個usercontrol。用戶控件來自DevExpress。 我用過usercontrol的load()事件。我用我的用戶控件應用程序使用xml文件。在usercontrol中,我添加了DevExpress xtraTreeList控件&我使用我的xml文件填充了xtraTreeList的節點。我的xml文件存在於我的應用程序目錄路徑中 - E:\ MsgBlasterApplicationtemp \ MsgBlasterApplication \ bin \ Debug \ Database。 當我拖動&在我的表單中放下我的usercontrol然後它給我錯誤。該錯誤是因爲follows--關於DevExpress UserControl

Failed to creste component ' TreeListUserControl'. The error message follows: 'System.IO.DirectoryNotFoundException:Could not find part of path.

回答

2

這是默認的行爲,你會重現它,如果你使用標準的GridView控件在用戶控件的標準。當用戶控件位於窗體上時,其上的所有控件都像運行應用程序一樣工作:(這裏是適合您的解決方案:

private void XtraUserControl1_Load(object sender, EventArgs e) { 
     if(!DesignMode) { 
      // your code to populate the treeList with data 
     } 
    }