PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET Printing the contents of a textbox

Reply

Printing the contents of a textbox

 
Thread Tools Rate Thread
Old 04-04-2006, 11:35 AM   #1
=?Utf-8?B?Sm9uYXRoYW4gU21pdGg=?=
Guest
 
Posts: n/a
Default Printing the contents of a textbox


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???
  Reply With Quote
Old 04-04-2006, 01:08 PM   #2
Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
Default Re: Printing the contents of a textbox

"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/>

  Reply With Quote
Old 04-04-2006, 01:24 PM   #3
=?Utf-8?B?Sm9uYXRoYW4gU21pdGg=?=
Guest
 
Posts: n/a
Default Re: Printing the contents of a textbox

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/>
>
>

  Reply With Quote
Old 04-04-2006, 01:37 PM   #4
Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
Default Re: Printing the contents of a textbox

"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/>
  Reply With Quote
Old 04-04-2006, 03:32 PM   #5
=?Utf-8?B?S2VycnkgTW9vcm1hbg==?=
Guest
 
Posts: n/a
Default RE: Printing the contents of a textbox

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???

  Reply With Quote
Old 04-04-2006, 05:16 PM   #6
Aziz
Guest
 
Posts: n/a
Default Re: Printing the contents of a textbox

perhaps this is what you mean?

Debug.Writeline("Hello")

  Reply With Quote
Old 05-04-2006, 12:07 AM   #7
james
Guest
 
Posts: n/a
Default Re: Printing the contents of a textbox

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")
>



  Reply With Quote
Old 10-04-2006, 05:39 AM   #8
Homer J Simpson
Guest
 
Posts: n/a
Default Re: Printing the contents of a textbox


"Jonathan Smith" <JonathanSmith@discussions.microsoft.com> wrote in message
news788E7CB-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


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off