473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Print job from windows Forms

Does anyone know where I can get a step-by-step walkthrough on how to Print
a document from VB Express 2005
Feb 3 '07 #1
5 2596
Ivan Jericevich schreef:
Does anyone know where I can get a step-by-step walkthrough on how to Print
a document from VB Express 2005

How hard have you searched already? A simple websearch on 'Print job
from windows Forms Visual Basic' returned
http://msdn2.microsoft.com/en-us/lib...he(VS.80).aspx as the
second link.
--
Tim Van Wassenhove <url:http://www.timvw.be/>
Feb 3 '07 #2
Thank you Tim, I have copied the code from your source but have only one
problem. 2 Errors both- Type 'StreamReader' is not defined.
What am I missing?

"Tim Van Wassenhove" <ti***@users.sourceforge.netwrote in message
news:eG**************@TK2MSFTNGP02.phx.gbl...
Ivan Jericevich schreef:
>Does anyone know where I can get a step-by-step walkthrough on how to
Print a document from VB Express 2005


How hard have you searched already? A simple websearch on 'Print job from
windows Forms Visual Basic' returned
http://msdn2.microsoft.com/en-us/lib...he(VS.80).aspx as the
second link.
--
Tim Van Wassenhove <url:http://www.timvw.be/>

Feb 3 '07 #3
Ivan Jericevich schreef:
Thank you Tim, I have copied the code from your source but have only one
problem. 2 Errors both- Type 'StreamReader' is not defined.
What am I missing?
StreamReader is short for System.IO.StreamReader... Or you could Imports
System.IO...

--
Tim Van Wassenhove <url:http://www.timvw.be/>
Feb 4 '07 #4
Tim your just great, I have managed to capture the form as a bitmap and
print it using the Print Dialog. Thanks for the help. Any ideas how I can
save the same bitmap image preferably as a Pdf file and save it to a file
folder on my c: drive. here is my code:
Dim memoryImage As Bitmap

Private Sub CaptureScreen()

Dim myGraphics As Graphics = Me.CreateGraphics()

Dim s As Size = Me.Size

memoryImage = New Bitmap(s.Width, s.Height, myGraphics)

Dim memoryGraphics As Graphics = Graphics.FromImage(memoryImage)

memoryGraphics.CopyFromScreen(Me.Location.X, Me.Location.Y, 0, 0, s)

End Sub

Private Sub printDocument1_PrintPage(ByVal sender As System.Object, ByVal e
As System.Drawing.Printing.PrintPageEventArgs) Handles _

PrintDocument1.PrintPage

e.Graphics.DrawImage(memoryImage, 0, 0)

End Sub

Public Shared Sub Main()

Application.Run(New FrmInvoice1())

End Sub

Private Sub BtnPrint_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BtnPrint.Click

CaptureScreen()

Dim PrintDialog1 As New PrintDialog()

PrintDialog1.Document = PrintDocument1

Dim result As DialogResult = PrintDialog1.ShowDialog()

If (result = DialogResult.OK) Then

PrintDocument1.Print()

End If

End Sub
"Tim Van Wassenhove" <ti***@users.sourceforge.netwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Ivan Jericevich schreef:
>Thank you Tim, I have copied the code from your source but have only one
problem. 2 Errors both- Type 'StreamReader' is not defined.
What am I missing?

StreamReader is short for System.IO.StreamReader... Or you could Imports
System.IO...

--
Tim Van Wassenhove <url:http://www.timvw.be/>

Feb 4 '07 #5
Ivan Jericevich schreef:
Tim your just great, I have managed to capture the form as a bitmap and
print it using the Print Dialog. Thanks for the help. Any ideas how I can
save the same bitmap image preferably as a Pdf file and save it to a file
folder on my c: drive. here is my code:
- Saving as an image file is easy: Simply use the Save method on the Bitmap

- Install a PDF printer, and select that printer with your printdocument

- Use a library like iTextSharp <url:http://itextsharp.sourceforge.net/>
and copy the image into the document...

--
Tim Van Wassenhove <url:http://www.timvw.be/>
Feb 4 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: hesing Qiang | last post by:
In Print Process,I use the code,but it is not run correctly On WINDOWS 98 . I didn't know why ...? this.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular,...
2
by: David Sabo | last post by:
Hi all... I having trouble printing on Win98. I cannot print more than once if I'm lucky in win98, when the printdocument.print() is executed the following Exception is raised. It doesn't start...
0
by: lumazi | last post by:
Hello all, I'm having an issue printing to a network printer. The line of code is fairly simple printDocument1.Print(); When you select print from a local printer it works fine, when you...
0
by: Tessa | last post by:
Is there any security reason why you cannot print to a network printer from ASP.NET under IIS6 on Windows 2003 server? I'm using ASP.NET code to print to a server print queue using...
16
by: Neal | last post by:
Hi, I saw the VB6 Code to do this at this link: http://www.dotnet247.com/247reference/msgs/11/56581.aspx The VB6 Code reads as follows: Private Type Rect Left As Long
2
by: Lars Netzel | last post by:
Is it hard to make a Print button from a Windows Form that will print a number of fields from an Access database in a fairly formatted way? How does this work with the Print Dialoges and stuff? ...
3
by: Brad Rogers | last post by:
All, Being immersed in vb.net and trying CSharp after almost a year I forgot the differences. I like vb fixing the uppercase/lowercase names and seeming to be more flexible to code entry. ...
5
by: Tony | last post by:
Every 10 seconds I need to search a SQL table for orders to print. The orders are created through WebForms on ASP.NET clients. The orders should not print until 10 minutes before they are due. ...
0
by: ShaneO | last post by:
There have been similar questions raised in the past, however no answers seem to have been provided, so I thought I'd give it a go. Scenario 1: My Windows Forms app generates (say) 10 pages in a...
24
by: Tony Girgenti | last post by:
Hello. Developing a Windows Form program in VS.NET VB, .NET Framework 1.1.4322 on a windows XP Pro, SP2. Before printing a document, i want to set the font to a font that is only available...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.