Solved

Print Envelope

Posted on 2009-07-02
7
347 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

732 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