private void btnSelectFile_Click(object sender, EventArgs e) { if (OFD.ShowDialog() == DialogResult.OK) { tbFile.Text = OFD.FileName; } }
/************************************************************ * La création d'un contrôle OpenFileDialog nommé OFD est nécessaire. * Ouvre une boite de dialogue "Explorateur de fichiers" * Récupére le chemin d'accès au fichier sélectionné et copie son contenu (ligne par ligne) dans une ListBox. *************************************************************/ private void btnOFD_Click(object sender, EventArgs e) { String ligne; OFD.Title = "Les fichiers texte."; //titre de la boite de dialogue OFD.Filter = "Fichiers texte|*.txt"; // Filtre : n'affiche que les fichiers ".txt" if (OFD.ShowDialog() == System.Windows.Forms.DialogResult.OK) { try { lbxFichiers.Items.Clear(); // vider la listbox StreamReader SR = new StreamReader(OFD.OpenFile()); // Ouvrir le flux en lecture while ((ligne = SR.ReadLine()) != null) //lire le fichier ligne par ligne { lbxFichiers.Items.Add(ligne); // copier les lignes du fichier dans la listBox } SR.Close(); // fermer le flux } catch { MessageBox.Show("Erreur: Lecture du fichier impossible"); } } }
public bool LerExtratos() { OFD.Filter = $@"Arquivos de extrato|*.{_conta.Banco.ExtensaoExtrato}|Todos os arquivos|*.*"; OFD.FileName = null; if (OFD.ShowDialog(this) != DialogResult.OK) { return(false); } OFD.InitialDirectory = Path.GetDirectoryName(OFD.FileNames[0]); var getAll = MessageBox.Show(@"Incluir todos os itens?", DialogTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes; _conta.LerExtratos(OFD.FileNames, getAll, _ctx.Regras.OrderByDescending(r => r.Ocorrencias)); if (!_conta.ExtratoHasData) { MessageBox.Show("Extrato não contém movimentos.", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } dgvExtrato.RowStateChanged -= dgvExtrato_RowStateChanged; bsExtrato.DataSource = _conta.Extrato; dgvExtrato.Refresh(); dgvExtrato.RowStateChanged += dgvExtrato_RowStateChanged; SelectRow(0); return(true); }
private void openBtn_Click(object sender, EventArgs e) { DialogResult Result; DGV1.EndEdit(); try { Result = OFD.ShowDialog(); if (Result == DialogResult.OK) { StreamReader FileToOpen = new StreamReader(OFD.FileName); OpenFileStream(FileToOpen); CurrentOpenFileName = OFD.FileName; txtRowCount1.Text = DGV1.RowCount.ToString(); txtColumnCount1.Text = DGV1.ColumnCount.ToString(); this.saveAsBtn.Enabled = true; this.saveBtn.Enabled = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.Cursor = Cursors.Arrow; } }
private void BtnOpen_Click(object sender, EventArgs e) { var Result = OFD.ShowDialog(); if (Result == DialogResult.OK) { try { if (File.Exists(OFD.FileName)) { var Rd = Service.LeerXml(OFD.FileName); if (Rd != null) { Red = Rd; } else { MessageBox.Show("El dataset está corrupto o está mal configurado"); } ShowInfo(Red); } else { MessageBox.Show("Se ha eliminado o movido el archivo"); } } catch (Exception er) { MessageBox.Show("Error al abrir el archivo => " + er.Message, "Proceso fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else if (Result == DialogResult.Cancel) { } }
private void btnBrowseBackupFile_Click(object sender, EventArgs e) { OFD.ShowDialog(); txtRestoreFile.Text = OFD.FileName; settings.Default.BackupFile = OFD.FileName; settings.Default.Save(); }
private void btnOpenImage_Click(object sender, EventArgs e) { OFD.Title = "Carregar Imagem"; OFD.Multiselect = true; OFD.Filter = "Image Files (*.png *.jpg *.bmp) |*png; *.jpg; *.bmp"; if (OFD.ShowDialog() == DialogResult.OK) { txtPathImage.Text = OFD.FileName; foreach (var myFile in OFD.FileNames) { // Criar um novo fluxo para carregar esta foto em var MyStream = new FileStream(myFile, FileMode.Open, FileAccess.Read); // Criar um buffer para armazenar o fluxo de bytes var myImageBuffer = new byte[(int)(MyStream.Length + 1)]; // Leia os bytes deste fluxo e colocá-lo no buffer de imagem MyStream.Read(myImageBuffer, 0, Convert.ToInt32(MyStream.Length)); // Fechar o fluxo MyStream.Close(); var Streamed = new MemoryStream(myImageBuffer); PicBox.Image = Image.FromStream(Streamed); Streamed.Close(); myImageBuffer = null; } } }
private void rbnBtnOpenEx_Click(object sender, EventArgs e) { try { //Preparing to show open file dialog : OFD.FileName = ""; OFD.Title = "Open an image file"; OFD.Filter = "JPEG Images (*.jpg)|*.jpg|Bitmap Images (*.bmp)|*.bmp"; OFD.ShowDialog(); if (OFD.FileName != "") { picExample.Load(OFD.FileName); } else { picExample.ImageLocation = ""; } } catch (Exception ex) { MessageBox.Show( ex.Message, "Open Dialog Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void tsb_Import_Click(object sender, EventArgs e) { OFD.Filter = "MiMfa Report Package Style File (*" + ReportStyle.Extension + ") | *" + ReportStyle.Extension; if (OFD.InitialDirectory == null) { OFD.InitialDirectory = ReportStyle.GetPath(); } if (OFD.ShowDialog() == DialogResult.OK) { ReportStyle report = new ReportStyle(); MiMFa_IOService.OpenDeserializeFile(OFD.FileName, ref report); if (string.IsNullOrEmpty(tstb_Subject.Text) || tstb_Subject.Text == "Default") { ReportStyle = report; } else { ReportStyle.MRLCode = report.MRLCode; ReportStyle.Script = report.Script; ReportStyle.Css = report.Css; ReportStyle.Extra = report.Extra; } ReportStyle.Address = OFD.FileName; } Initialize(null, ReportStyle, false); }
private void MS_File_Open_Click(object sender, System.EventArgs e) { OFD.FileName = ""; SS_LBStatus.Text = "圖片開啟中"; if (OFD.ShowDialog() == DialogResult.OK) { StopProcess(); this.Cursor = Cursors.WaitCursor; string filepath = OFD.FileName; OImg = new Bitmap(filepath); RImg = new Bitmap(filepath); OrQImg = GrayImg.From(filepath); OrSImg = BGRImg.From(filepath); PB_Result.Image = OrQImg.ToImage(); PB_Result.Height = FLP_Result.Height; PB_Result.Width = OrQImg.Width * FLP_Result.Height / OrQImg.Height; QImg = OrQImg.Extend(); SImg = OrSImg.Extend(); K = new SimpleMotionKernel(QImg.Width, QImg.Height, 53); QImg.FFT2(); SImg.FFT2(); QThread = new Thread(QProcess); QThread.Start(); this.Cursor = Cursors.Default; } }
private string[] GetExtratoAcoes() { OFD.DefaultExt = "csv"; OFD.Filter = @"CSV files|*.csv"; OFD.Multiselect = false; return((OFD.ShowDialog() == DialogResult.Cancel) ? null : OFD.FileNames); }
private void CmBCargar_Click(object sender, EventArgs e) { if (TxtRuta.Text == "") { if (OFD.ShowDialog(this) == DialogResult.OK) { TxtRuta.Text = OFD.FileName; } } try { //Des-serializa la colección de vértices lstPuntos3d = Geometry.Geometrias.Serialize.Serialize.DesSerializaPuntos3D(TxtRuta.Text); } catch (Exception sysEx) { System.Windows.Forms.MessageBox.Show(this, sysEx.ToString(), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); lstPuntos3d = new List <Punto3D>(); } CargarDGV(); }
private void btn_FIle_Click(object sender, EventArgs e) { if (OFD.ShowDialog() == DialogResult.OK) { File_Read(OFD.FileName); } }
private void btnOpen_Click(object sender, EventArgs e) { if (OFD.ShowDialog() == DialogResult.OK) { tbInput.Text = OFD.FileName; } }
private void LoadButton_Click(object sender, EventArgs e) { Console.WriteLine("HI"); if (OFD.ShowDialog() == DialogResult.OK) { Console.WriteLine("HI"); StreamReader sr = new StreamReader(OFD.FileName); CmdName.Text = sr.ReadLine(); //command name while (sr.EndOfStream == false) { string[] split = sr.ReadLine().Split(' '); foreach (string i in split) { i.Replace(' ', '~'); i.Replace("~", "\\~"); } Blocks b = new Blocks(); b.com = split[0]; b.a1 = split[1]; b.a2 = split[2]; b.a3 = split[3]; b.a4 = split[4]; CommandSpace.Controls.Add(b); Console.WriteLine("YES!"); CommandSpace.Update(); } sr.Close(); sr.Dispose(); } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { if (OFD.ShowDialog() == DialogResult.OK) { OpenFile(OFD.FileName); } }
void miParseOnly_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { var mi = e.ClickedItem as ToolStripMenuItem; btnOption.HideDropDown(); if (mi == miRunDownloader && (miRunDownloader.Checked || !File.Exists(AppConfig.Settings.ExternalDownloader)) && OFD.ShowDialog() == DialogResult.OK) { AppConfig.Settings.ExternalDownloader = OFD.FileName; } if (File.Exists(AppConfig.Settings.ExternalDownloader)) { miCopyURL.Checked = miRunDownloader.Checked = false; mi.Checked = true; } else { miCopyURL.Checked = true; miRunDownloader.Checked = false; mi = miCopyURL; } AppConfig.Settings.ExternalMethod = miParseOnly.DropDownItems.IndexOf(mi); }
private void btSimVFR_Click(object sender, EventArgs e) { lblLink.Text = "..."; btSimVFR.BackColor = btDropLink.BackColor; // this is the native button color... OFD.Filter = "Script Files|*.vsc|All Files|*.*"; OFD.Title = "Load VFR Model File"; if (OFD.ShowDialog(this) == DialogResult.OK) { lblLink.Text = $"Simulation of: {OFD.FileName}\n"; var sim = new VFRSimulation(m_dataLocation, 2, cbxLogging.Enabled); if (sim.Valid) { btSimVFR.BackColor = Color.ForestGreen; if (!sim.RunSimulation(OFD.FileName, txRwy.Text)) { lblLink.Text += sim.Error; btSimVFR.BackColor = Color.IndianRed; } else { lblLink.Text += "KML File created in script folder"; } } else { // error lblLink.Text += sim.Error; btSimVFR.BackColor = Color.IndianRed; } lblLink.Text += $"DONE"; } }
private void button1_Click(object sender, EventArgs e) { contTXT += 1; OFD.Title = "Seleccione el archivo de TXT"; OFD.FileName = string.Empty; OFD.Filter = "Archivos de TXT (*.txt)|*.txt"; OFD.ShowDialog(); }
} //Fin de metodo ok de open file dialog private void btnXML_Click(object sender, EventArgs e) { contXML += 1; OFD.Title = "Seleccione el archivo de XML"; OFD.FileName = string.Empty; OFD.Filter = "Archivos de XML (*.xml)|*.xml"; OFD.ShowDialog(); }
private void button1_Click(object sender, EventArgs e) { if (OFD.ShowDialog() == DialogResult.OK) { file = OFD.FileName; this.fileName.Text = OFD.FileName; } }
private void cmdBrowse_Click(object sender, EventArgs e) { if (OFD.ShowDialog() == DialogResult.OK) { cboFilename.Text = OFD.FileName; cboName.Text = Path.GetFileNameWithoutExtension(OFD.FileName); } }
private void btnBoot_Click(object sender, EventArgs e) { OFD.Filter = BOOT; if (OFD.ShowDialog() == DialogResult.OK) { tbBoot.Text = OFD.FileName; } }
private void btnReadme_Click(object sender, EventArgs e) { OFD.Filter = README; if (OFD.ShowDialog() == DialogResult.OK) { tbReadme.Text = OFD.FileName; } }
private void btnSelectFile_Click(object sender, EventArgs e) { OFD.CheckFileExists = false; if ((int)OFD.ShowDialog() == (int)System.Windows.Forms.DialogResult.OK) { txtFileName.Text = OFD.FileName; } }
private void tsb_ChangeStyle_Click(object sender, EventArgs e) { OFD.Filter = "All File(*" + ReportStyle.Extension + ") | *" + ReportStyle.Extension + ""; if (OFD.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(OFD.FileName)) { ChangeStyle(OFD.FileName); } }
private void cbSelectSource_Click(object sender, EventArgs e) { if (OFD.ShowDialog() == System.Windows.Forms.DialogResult.OK) { txtSource.Text = OFD.FileName; txtDest.Text = txtSource.Text + ".dict"; } }
private void btnCargar_Click(object sender, EventArgs e) { contExcel += 1; OFD.Title = "Seleccione el archivo de Excel"; OFD.FileName = string.Empty; OFD.Filter = "Archivos de Excel (*.xls;*.xlsx)|*.xls;*.xlsx"; OFD.ShowDialog(); }
private void btnKeyfile_Click(object sender, EventArgs e) { if (OFD.ShowDialog() == DialogResult.OK) { tbKeyfile.Text = OFD.FileName; cbKeyfile.Checked = true; } }
private void pb_profile_Click(object sender, EventArgs e) { //open dialog and select picture if (OFD.ShowDialog() == DialogResult.OK) { pb_profile.Image = Image.FromFile(OFD.FileName); } }