/// <summary>
        /// Gets the new csv file name and path.
        /// This method should be used with the methods:
        /// CsvThread().
        /// ToCsV().
        /// </summary>
        /// <param name="dGV">Extended DataGridView.</param>
        /// <param name="filename">Name of csv file.</param>
        void GetCsvReady(DataGridViewPersonalizat dGV, string filename)
        {
            dGV.Invoke
            (
                new MethodInvoker
                (
                    delegate
            {
                SaveFileDialog dialog = new SaveFileDialog();
                dialog.Filter         = "Comma Separated Value (*.csv)|*.csv";
                dialog.FileName       = filename;
                dialog.ValidateNames  = true;

                if (dialog.ShowDialog(dGV) == DialogResult.Cancel)
                {
                    filename = null;
                }
                else
                {
                    filename = dialog.FileName;
                }

                if (filename == null)
                {
                    return;
                }
            }
                )
            );

            // Export data.
            ToCsV(dGV, filename);
        }
Beispiel #2
0
        /// <summary>
        /// Gets the new csv file name and path.
        /// This method should be used with the methods:
        /// CsvThread().
        /// ToCsV().
        /// </summary>
        /// <param name="dGV">Extended DataGridView.</param>
        /// <param name="filename">Name of csv file.</param>
        void GetCsvReady(DataGridViewPersonalizat dGV, List <string> pListaColoaneImprimare, string filename, string pSeparator, bool pDeschideDupaCreare)
        {
            if (string.IsNullOrEmpty(filename))
            {
                dGV.Invoke
                (
                    new MethodInvoker
                    (
                        delegate
                {
                    SaveFileDialog dialog = new SaveFileDialog();
                    dialog.Filter         = "Comma Separated Value (*.csv)|*.csv";
                    dialog.FileName       = filename;
                    dialog.ValidateNames  = true;

                    if (dialog.ShowDialog(dGV) == DialogResult.Cancel)
                    {
                        filename = null;
                    }
                    else
                    {
                        filename = dialog.FileName;
                    }

                    if (filename == null)
                    {
                        return;
                    }
                }
                    )
                );
            }

            // Export data.
            ToCsV(dGV, pListaColoaneImprimare, filename, pSeparator, pDeschideDupaCreare);
        }