PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
Printing the contents of a textbox
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
Printing the contents of a textbox
![]() |
Printing the contents of a textbox |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
In VB i had some very very simple code that would print out the contents of a
textbox for me. It was simply Sub PrintTB() Printer.Print(Text1.Text) End sub Very simple, and 110% effective. How the hell do i do this in VB .Net??? |
|
|
|
#2 |
|
Guest
Posts: n/a
|
"Jonathan Smith" <JonathanSmith@discussions.microsoft.com> schrieb:
> In VB i had some very very simple code that would print out the contents > of a > textbox for me. > > It was simply > > Sub PrintTB() > Printer.Print(Text1.Text) > End sub > > Very simple, and 110% effective. > > How the hell do i do this in VB .Net??? That's not as easy. You will have to use the 'PrintDocument' object and draw the string onto the printer using 'e.Graphics.ToString' in the 'PrintDocument''s 'PrintPage' event handler. 'PrintDocument' won't to paging automatically, so you'll have to measure the text you are printing and start a new page using 'e.HasMorePages' manually, which will cause 'PrintPage' to be called one more time for the next page. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Are you serious????
All i want to do is print the contents of a textbox "Herfried K. Wagner [MVP]" wrote: > "Jonathan Smith" <JonathanSmith@discussions.microsoft.com> schrieb: > > In VB i had some very very simple code that would print out the contents > > of a > > textbox for me. > > > > It was simply > > > > Sub PrintTB() > > Printer.Print(Text1.Text) > > End sub > > > > Very simple, and 110% effective. > > > > How the hell do i do this in VB .Net??? > > That's not as easy. You will have to use the 'PrintDocument' object and > draw the string onto the printer using 'e.Graphics.ToString' in the > 'PrintDocument''s 'PrintPage' event handler. 'PrintDocument' won't to > paging automatically, so you'll have to measure the text you are printing > and start a new page using 'e.HasMorePages' manually, which will cause > 'PrintPage' to be called one more time for the next page. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
"Jonathan Smith" <JonathanSmith@discussions.microsoft.com> schrieb:
> Are you serious???? Yes, I am. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Jonathan,
The .Net framework includes classes that allow you to build sophisticated print capabilities into an app. But something as simple as the VB6 Printer object is not included. You can google for .Net printing and find several third-party tools that attempt to give you capabilities similar to the VB6 Printer object. I have not tried these tools so I can't recommend any of them. Kerry Moorman "Jonathan Smith" wrote: > In VB i had some very very simple code that would print out the contents of a > textbox for me. > > It was simply > > Sub PrintTB() > Printer.Print(Text1.Text) > End sub > > Very simple, and 110% effective. > > How the hell do i do this in VB .Net??? |
|
|
|
#6 |
|
Guest
Posts: n/a
|
perhaps this is what you mean?
Debug.Writeline("Hello") |
|
|
|
#7 |
|
Guest
Posts: n/a
|
That won't print to the printer like he wishes to do.
james "Aziz" <aziz001@googlemail.com> wrote in message news:1144167373.141778.8610@u72g2000cwu.googlegroups.com... > perhaps this is what you mean? > > Debug.Writeline("Hello") > |
|
|
|
#8 |
|
Guest
Posts: n/a
|
"Jonathan Smith" <JonathanSmith@discussions.microsoft.com> wrote in message news 788E7CB-19EE-4834-8C08-E29E5160E2E0@microsoft.com...> Are you serious???? > > All i want to do is print the contents of a textbox There's a really good run down of how do this in "Visual Basic 2005 Express Edition for Dummies 2005", CHAPTER 9 Hint: http://www.dummies.com/WileyCDA/Dum...051,page-1.html |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

788E7CB-19EE-4834-8C08-E29E5160E2E0@microsoft.com...
