Solved

Power Pack Visual Studio 2008   PrintForm1

Posted on 2013-06-28
2
746 Views
Last Modified: 2013-07-03
Windows forms  visual studio 2008  I  am using the following code to print a form  
this is working fine but I have to issues

1-I need to insert the Date  on the file name, with this code it does but it only puts the year
example  "2013 Enh A Shift"   I need to be the   Month/Date/Year + File name

2-  I need to hardcode the path to the file to be save right now by default comes on the document folders. I want a Network Share path

 Dim a As Date
        a = Format(Today, "short date")
        Dim pf As New PrintForm
        pf.Form = Me
        pf.Form.BackColor = Color.White
        pf.Form.Controls.Remove(bntprint)
        pf.Form.Controls.Remove(bntcryovac)
        pf.PrinterSettings.DefaultPageSettings.Landscape = True
        pf.PrintAction = Printing.PrintAction.PrintToPrinter
        pf.PrinterSettings.PrinterName = "Adobe PDF"
        pf.DocumentName = a & " " & "ENH A SHIFT"
        pf.Print()
        pf.Form.Controls.Add(bntprint)
        pf.Form.Controls.Add(bntcryovac)




Can you provide me with some samples. thanks
0
Comment
Question by:teogos
2 Comments
 
LVL 15

Accepted Solution

by:
angus_young_acdc earned 350 total points
ID: 39284660
Your date won't be in the correct format, the slash '/' will be taken as a breakdown of folders.

Instead you could use this:
a = Today.ToString("MM-dd-yyy")

That will give you the month, day and year.   The rest of the code would remain as it is.

I don't use the PowerPacks so can't help with setting the default path for PrintForm.
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 150 total points
ID: 39287206
You are printing to a printer so why is file path involved? Are you printing to PDF? If yes then the save as dialog as shown by pdf print driver so you may not be able to  control that.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question