Solved

Print Envelope

Posted on 2009-07-02
7
334 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

759 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

17 Experts available now in Live!

Get 1:1 Help Now