Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 05-15-2007, 12:32 AM   #1
Bogan
 
Neodude112320's Avatar
 
Join Date: Feb 2006
Location: Australia
Posts: 8,471
Send a message via MSN to Neodude112320
Question printing a multiline docuement in Visual basic 2005

How do you print a multiline document,So it will print the First name and the last name on the same line and start a new line and print the address?

PublicClass Form1
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Print AsNew myPrinter
Print.prt(px.Text &
"." & fn.Text & " " & ln.Text & " " & add.Text)


EndSub
End
Class
Public
Class myPrinter
Friend TextToBePrinted AsString
PublicSub prt(ByVal text AsString)
TextToBePrinted = text
Dim prn AsNew Printing.PrintDocument
Using (prn)
prn.PrinterSettings.PrinterName _
=
"Canon Bubble-Jet BJC-2100SP"
AddHandler prn.PrintPage, _
AddressOfMe.PrintPageHandler
prn.Print()
RemoveHandler prn.PrintPage, _
AddressOfMe.PrintPageHandler
EndUsing
EndSub
PrivateSub PrintPageHandler(ByVal sender AsObject, _
ByVal args As Printing.PrintPageEventArgs)
Dim myFont AsNew Font("Microsoft San Serif", 20)
args.Graphics.DrawString(TextToBePrinted, _
New Font(myFont, FontStyle.Regular), _
Brushes.Black, 50, 50)
EndSub
End
Class

This is for a label maker.
__________________
Desktop:BitFenix Survivor~Gigabyte GA-P67A-UD3R~ i7 2600K @ 4hz~AMD 6870 1GB~12gb Team Elite DDR3 1333~3xWD In RAID5~W7 Ult
Laptop:Alienware M11x~ i7-2637M 1.7GHz~16GB 1333MHz DDR3~GeForce GT 540M~W7 Ult
Neodude112320 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 03:56 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0