Sliverlight4中打开客户端文件,debug时会报这个错误!

 

                OpenFileDialog ofld = new OpenFileDialog();
                ofld.Multiselect = false
                bool flag = (bool)ofld.ShowDialog();
                 if (flag == true)
                {
                    string name = ofld.File.Name;
                    Stream stream = ofld.File.OpenRead();

                    stackpanel_工作表选择.Visibility = Visibility.Collapsed;
                    excel_xml_worksheet_import = new madamingExcelXMLWorkSheetImport(stream);
                    stackpanel_工作表选择.Visibility = Visibility.Visible;

                    combobox_工作表选择.Items.Clear();
                    for (int i = 0; i < excel_xml_worksheet_import.WorkSheets.Count(); i++)
                    {
                        ComboBoxItem c = new ComboBoxItem();
                        c.Content = excel_xml_worksheet_import.WorkSheets[i].WorksheetName;
                        combobox_工作表选择.Items.Add(c);
                    }
                    if (combobox_工作表选择.Items.Count() > 0) combobox_工作表选择.SelectedIndex = 0;
 }   

   当将断电设置在下列代码中或之前时就会报错:

  OpenFileDialog ofld = new OpenFileDialog();

ofld.Multiselect = false
bool flag = (bool)ofld.ShowDialog();

 

将断点设置在其后就可以了!原因可能是在生成ofld示例后到ShowDialog之前不能有时间上的停顿 

相关文章:

  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2021-09-26
  • 2021-05-27
  • 2021-10-20
  • 2021-04-23
  • 2021-08-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2022-01-01
  • 2021-11-29
  • 2021-10-15
  • 2022-12-23
相关资源
相似解决方案