473,804 Members | 3,320 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(ByV al e As PrintPageEventA rgs)

MyBase.OnPrintP age(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.Regul ar,
GraphicsUnit.Po int)
e.Graphics.Draw String(StudentT oPrint.GetCombo Name, 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 964

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

Similar topics

4
4862
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 selected. For example, if I were to have 5 pages with every second page printing, I would get the following results: Page 1 = Print OK Page 2 = Blank Page 3 = Print OK Page 4 = Blank
4
1607
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", it was decided that this was a bug and that Safe Printing does not work. I just need to verify that these findings are correct. Thanks, Jody
3
705
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 is DefaultPrinter, it is set to false when I know that I have that printer set as default (I verify via the "Printers and Fax" applet Can anyone confirm or explain TIA
5
2230
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 "compile the questions" into a theoretical problem to see what people think should be done to solve it. Maybe it will be a worthwhile discussion, but more importantly maybe it will find out the very best way to sort this kind of problem out so that...
1
1305
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 printing server, which worked fine since we weren't printing duplex. We'd like to now split the jobs up and send them individually, which we easily achieved using a while loop to send each job.
0
1254
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 candidates have mastered the office applications or not. we have to develop the test engine in delphi(we have done that).
3
1482
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 insert data (each time different data). 2. when i'll finish my program (soon i hope...) i need to create a setup disc. how can i create a setup, i want to include in my setup also files that not exsist in my project, and i need to know how can i...
1
2603
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 completing my work. Basic problem is that when I select to print many copies or collate printout then nothing happence. It prints the first page and stops. Also I get different information regarding printer's capacity (please see below). Example...
4
2076
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 fine. If htey choose to "just print it" it seems ot ignore this command:
0
9569
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10558
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10302
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7608
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5503
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2975
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.