Solved

Power Pack Visual Studio 2008   PrintForm1

Posted on 2013-06-28
2
736 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now