473,402 Members | 2,055 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,402 software developers and data experts.

Printing Questions

I am trying to learn how to print with VB.net but the book I'm using has lots
of mistakes. Here is the code which is almost directly copied from the book
I'm using:

Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Printing
Public Class PrintClass
Inherits PrintDocument

Public StudentToPrint As StudentData

Protected Overrides Sub OnPrintPage(ByVal e As PrintPageEventArgs)

MyBase.OnPrintPage(e)

'string formatting - goal to right align
Dim args As New System.Drawing.StringFormat

args.Alignment = StringAlignment.Far

'set margins - would like 1" margins
Dim rect As Rectangle = e.MarginBounds

'put text on the document
Dim fnt As New Font("Arial", 10, FontStyle.Regular,
GraphicsUnit.Point)
e.Graphics.DrawString(StudentToPrint.GetComboName, fnt,
Brushes.Black, 0, 0, args)
fnt.Dispose()

'last page
e.HasMorePages = False

End Sub

End Class
StudentData is a class that I created myself and is working properly.

Notice how rect is defined but never used! How do I set 1" margins on the
page?

Is it possible to have text both left and right aligned in the same
document? I would like to do this if possible. Is there a good example that
might help me? Hopefully there aren;t many errors in this code. Thanks for
the help.
Jul 21 '05 #1
0 947

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

Similar topics

4
by: Jody Gelowitz | last post by:
I am having a problem with printing selected pages. Actually, the problem isn't with printing selected pages as it is more to do with having blank pages print for those pages that have not been...
4
by: Jody Gelowitz | last post by:
I was just wondering if anybody has been able to figure out how to get Safe Printing working over an Internet Zone. Based on what was mentioned from the previous thread titled "Safe Printing",...
3
by: RBisch | last post by:
I am finding that some of the properties off of the PrinterSettings object are misleading For example, When I test the CanDuplex on a printer I know duplexes, the property is false. Another one...
5
by: Mark Preston | last post by:
Admission first - I don't actually have a problem here but have noticed that a lot of people have been asking similar questions and getting very varied answers. What I've done is to sort of...
1
by: cbennett | last post by:
Hello, I'm a *novice* at both using PHP and UNIX, and came across a problem while trying to modify an ex-coworkers PHP code for printing. The original script sent one huge print job to our...
0
by: nikolaos | last post by:
Hi all!! i am relatively new to this forum. i am working on a big project in athens greece. it is all about office and vba. basically it is an automated testing software that tests whetther...
3
by: Gidi | last post by:
hello, i'm writing a windows application in c# and i have few questions: 1. where can i read or see examples about printing documents which i'll create in my forms. i want to print tables and...
1
by: Pohihihi | last post by:
Hello NG. I am using System.Drawing.Printing NS to print few label style printouts. I figured out how the basics goes in that namespace but there are still few things that is holding me up from...
4
by: scorpion53061 | last post by:
I have my Word document being created in a seperate thread. THe applicaiton is not visible. The end user can choose to view the document upon completion or just have it print. Viewing is...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.