By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,344 Members | 1,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,344 IT Pros & Developers. It's quick & easy.

Printing the contents of a textbox

P: 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???
Apr 4 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
"Jonathan Smith" <Jo***********@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/>

Apr 4 '06 #2

P: n/a
Are you serious????

All i want to do is print the contents of a textbox

"Herfried K. Wagner [MVP]" wrote:
"Jonathan Smith" <Jo***********@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/>

Apr 4 '06 #3

P: n/a
"Jonathan Smith" <Jo***********@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/>
Apr 4 '06 #4

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

Apr 4 '06 #5

P: n/a
perhaps this is what you mean?

Debug.Writeline("Hello")

Apr 4 '06 #6

P: n/a
That won't print to the printer like he wishes to do.
james

"Aziz" <az*****@googlemail.com> wrote in message
news:11********************@u72g2000cwu.googlegrou ps.com...
perhaps this is what you mean?

Debug.Writeline("Hello")

Apr 4 '06 #7

P: n/a

"Jonathan Smith" <Jo***********@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.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/Dumm...51,page-1.html
Apr 10 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.