Solved

Print Envelope

Posted on 2009-07-02
7
341 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

777 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