private void button_findFile_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "请指定要打开的书目转储文件名"; dlg.FileName = this.textBox_source_fileName.Text; // dlg.InitialDirectory = dlg.Filter = "书目转储文件 (*.bdf)|*.bdf|All files (*.*)|*.*"; dlg.RestoreDirectory = true; if (dlg.ShowDialog() != DialogResult.OK) { return; } string fileName = dlg.FileName; string strError = ""; int nRet = ImportBdf.DoImport(fileName, out strError); if (nRet == -1) { MessageBox.Show(this, "出错:" + strError); return; } MessageBox.Show(this, "导入成功" + nRet + "条"); }
private void button_import_Click(object sender, EventArgs e) { string fileName = this.textBox_source_fileName.Text; string strError = ""; int nRet = ImportBdf.DoImport(fileName, out strError); if (nRet == -1) { MessageBox.Show(this, "出错:" + strError); return; } MessageBox.Show(this, "导入成功" + nRet + "条"); }