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

Printing contents of textbox wth VB.Net?

P: n/a
This is a stupid question, but the examples I've seen don't make sense to
me...

I simply want to print the contents of a textbox to a printer when the user
clicks a button on my form. Printing to the default printer is fine, but
eventually I will want the user to be able to choose a printer (not
necessarily at print time).

Can someone show or link me to a simple sample of the CLICK event for a
print button that just dumps the contents of TEXTBOX1 to the default
printer?

Thanks
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
* "Grahammer" <po********@127.0.0.1> scripsit:
This is a stupid question, but the examples I've seen don't make sense to
me...

I simply want to print the contents of a textbox to a printer when the user
clicks a button on my form. Printing to the default printer is fine, but
eventually I will want the user to be able to choose a printer (not
necessarily at print time).

Can someone show or link me to a simple sample of the CLICK event for a
print button that just dumps the contents of TEXTBOX1 to the default
printer?


You will find a sample for printing + printer selection here (notice
that comments are only avalilable in German):

<http://www.mvps.org/dotnet/dotnet/samples/printing/downloads/PrintFramework.zip>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

P: n/a
Hi,

There is good article in MSDN Magazine illustrating how to output a text
file to a printer. This was definitely this year issue, but I don't remember
the exact month. It is little bit more complex, but you should get the basic
idea and simplify the example to fit your needs by replacing the file
content with TEXTBOX1 content and wiring the Click event handler the way you
need it.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Grahammer" <po********@127.0.0.1> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl...
This is a stupid question, but the examples I've seen don't make sense to
me...

I simply want to print the contents of a textbox to a printer when the user clicks a button on my form. Printing to the default printer is fine, but
eventually I will want the user to be able to choose a printer (not
necessarily at print time).

Can someone show or link me to a simple sample of the CLICK event for a
print button that just dumps the contents of TEXTBOX1 to the default
printer?

Thanks


Nov 20 '05 #3

P: n/a
Thanks

I've seen a few examples of this... But for some reason it just doesn't
*click* for me. My head is still in GWBasic, although I've done a fair bit
of work with VB6. I think the file handling is confusing me as well.

It could just be trying to read it on the screen instead of on paper that's
causing me some trouble. For some reason hardcopy is easier for me to
follow.

Thanks again!

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> wrote
in message news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

There is good article in MSDN Magazine illustrating how to output a text
file to a printer. This was definitely this year issue, but I don't remember the exact month. It is little bit more complex, but you should get the basic idea and simplify the example to fit your needs by replacing the file
content with TEXTBOX1 content and wiring the Click event handler the way you need it.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Grahammer" <po********@127.0.0.1> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl...
This is a stupid question, but the examples I've seen don't make sense to me...

I simply want to print the contents of a textbox to a printer when the

user
clicks a button on my form. Printing to the default printer is fine, but
eventually I will want the user to be able to choose a printer (not
necessarily at print time).

Can someone show or link me to a simple sample of the CLICK event for a
print button that just dumps the contents of TEXTBOX1 to the default
printer?

Thanks

Nov 20 '05 #4

P: n/a

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bp*************@ID-208219.news.uni-berlin.de...
* "Grahammer" <po********@127.0.0.1> scripsit:
This is a stupid question, but the examples I've seen don't make sense to me...

I simply want to print the contents of a textbox to a printer when the user clicks a button on my form. Printing to the default printer is fine, but
eventually I will want the user to be able to choose a printer (not
necessarily at print time).

Can someone show or link me to a simple sample of the CLICK event for a
print button that just dumps the contents of TEXTBOX1 to the default
printer?


You will find a sample for printing + printer selection here (notice
that comments are only avalilable in German):

<http://www.mvps.org/dotnet/dotnet/sa...PrintFramework
..zip>

Thanks... Looks interesting.

I should be able to figure out most of the comments and use Babelfish to
convert any others.

This is starting to look like there is no simple way to just print a couple
lines of text. BLECH!
Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.