Solved

Print Envelope

Posted on 2009-07-02
7
339 Views
Last Modified: 2012-05-07
I have a form with 6 TextBoxes on it called..
to, addr1,addr2,city,state,zip
I would like for the user to click a button and and print a standard envelope with the textbox data in block address format.  How can this be done?
0
Comment
Question by:H-SC
  • 4
  • 3
7 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24770694
0
 
LVL 1

Author Comment

by:H-SC
ID: 24787198
CodeCruiser,

Thanks for the reply.. I have worked on this a bit and have the textboxes as parameters in a rdlc report.  how can I preset the printer to envelope so that the user does not have to preview and then set.  I would like to do this when the print button is clicked and not as a default on the printer itself
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 24789157
Hi,
Good to hear that you are making some progress. Here are a few pointers which would help you in changing printer settings. Also included is some example code

http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23652782.html

http://www.codeproject.com/KB/dotnet/NET_Printer_Library.aspx
Private settings As New PrinterSettings()

Private page As PageSettings

 

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Form1.Load

    '' Populate a combobox with all the printer names

    comboPrinters.BeginUpdate()

    comboPrinters.Items.Clear()

    For Each name As String In PrinterSettings.InstalledPrinters

        comboPrinters.Items.Add(name)

    Next

    comboPrinters.EndUpdate()

    comboPrinters.SelectedItem = settings.PrinterName

End Sub

 

Private Sub comboPaperSizes_SelectedValueChanged(ByVal sender As Object, ByVal e As EventArgs) Handles comboPaperSizes.SelectedValueChanged

    page = New PageSettings(settings)

    page.PaperSize = DirectCast(comboPaperSizes.SelectedValue, PaperSize)

End Sub

 

Private Sub comboPrinters_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles comboPrinters.SelectedIndexChanged

    '' Populate a combox with paper sizes 

    settings.PrinterName = DirectCast(comboPrinters.SelectedItem, String)

    Dim sizes As New BindingList(Of PaperSize)()

    For Each size As PaperSize In settings.PaperSizes

        sizes.Add(size)

    Next

    comboPaperSizes.DisplayMember = "PaperName"

    comboPaperSizes.DataSource = sizes

End Sub

Open in new window

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:H-SC
ID: 24789387
CodeCruiser,

This is perfect...one more question on this.  Can I set the number Of Copies property anywhere via code.

Thank you again
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24792245
You can use the PrinterSettings.Copies property to set the number of copies to print.

settings.Copies = 5
0
 
LVL 1

Author Comment

by:H-SC
ID: 24793558
CodeCruiser,
many thanks! for your much needed help with this one
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24793591
I am happy that your problem is sorted.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

861 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

20 Experts available now in Live!

Get 1:1 Help Now