Beispiel #1
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            string saveLocation = "";

            if (string.IsNullOrEmpty(tboxFileName.Text))
            {
                MessageBox.Show("Please enter file name");
                return;
            }

            using (var fbd = new FolderBrowserDialog())
            {
                DialogResult result = fbd.ShowDialog();

                if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
                {
                    saveLocation = fbd.SelectedPath + @"\" + tboxFileName.Text + ".pdf";
                }
            }
            if (string.IsNullOrEmpty(saveLocation))
            {
                return;
            }

            PDFManager.createPDFfromList <ProductLocation>((List <ProductLocation>)dgv.DataSource, tboxFileName.Text, saveLocation);
        }