Exemple #1
0
 private void buttonFile_Click(object sender, EventArgs e)
 {
     if (OpenFiles.ShowDialog() == DialogResult.OK)
     {
         AttachFiles.DataSource = OpenFiles.SafeFileNames;
     }
 }
Exemple #2
0
        /// <summary>
        /// Permite abrir un nuevo texto
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Open_Click(object sender, EventArgs e)
        {
            OpenFiles.InitialDirectory = "c:\\";
            OpenFiles.Filter           = "txt files (*.txt)|*.txt|All files (*.*)|*.*|rtf files (*.rtf)|*.rtf"; //Filtra ficheros de texto y rtf
            OpenFiles.FilterIndex      = 2;
            OpenFiles.RestoreDirectory = true;

            if (OpenFiles.ShowDialog() == DialogResult.OK)
            {
                filePath = OpenFiles.FileName;
                rutas.Items.Add(filePath);
            }


            richTextBox1.Clear();

            if (Path.GetExtension(OpenFiles.FileName) == ".txt")
            {
                richTextBox1.LoadFile(OpenFiles.FileName, RichTextBoxStreamType.PlainText);
            }
            else if (Path.GetExtension(OpenFiles.FileName) == ".rtf")
            {
                richTextBox1.LoadFile(OpenFiles.FileName, RichTextBoxStreamType.RichText);
            }

            openFile = true;
        }
Exemple #3
0
 private void OpenToolStripMenuItem_Click(object sender, System.EventArgs e)
 //open data dialog and show processed text
 {
     this.Activate();
     OpenFiles.ShowDialog();
     string[] names = OpenFiles.FileNames;
     if (names == Array.Empty <string>())
     {
         return;
     }
     try
     //get text from data output glued data on the screen
     {
         data = new DataSet(names);
         skriptTextField.Text = data.getResultData();
     }
     catch (System.IO.FileNotFoundException Ex)
     //handles data expetions
     {
         MessageBox.Show(Ex.Message + "\nНет такого файла",
                         "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     catch (Exception Ex)
     //handles other expetions
     {
         MessageBox.Show(Ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Exemple #4
0
        /// <summary>
        /// Abre una ventana para seleccionar los archivos
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ShowFiles_Click(object sender, EventArgs e)
        {
            OpenFiles.InitialDirectory = "c:\\";
            OpenFiles.Filter           = "txt files (*.txt)|*.txt|All files (*.*)|*.*|rtf files (*.rtf)|*.rtf";
            OpenFiles.FilterIndex      = 2;
            OpenFiles.RestoreDirectory = true;

            if (OpenFiles.ShowDialog() == DialogResult.OK)
            {
                filePath = OpenFiles.FileName;
                rutas.Items.Add(filePath);
            }
        }