private void btnSave_Click(object sender, EventArgs e) { if (_workWithForm.IsEditMode()) { _dtpFile.Name = tbName.Text; TextBox tbFile = ucFile.Controls["tbFile"] as TextBox; _dtpFile.File = tbFile.Text; _dtpFile.Save(); DialogResult = System.Windows.Forms.DialogResult.OK; } else { _workWithForm.SetEditMode(true); } }
private void btnAddFile_Click(object sender, EventArgs e) { if (tryCopyData()) { _dtp.Save(); OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true; ofd.ShowDialog(); foreach (string file in ofd.FileNames) { DTPFile dtpFile = _dtp.createFile(); dtpFile.Name = Path.GetFileNameWithoutExtension(file); dtpFile.File = file; dtpFile.Save(); _dtpFileList.Add(dtpFile); } FillDgv(); } }