473,781 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Printing contents of textbox wth VB.Net?

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
4 4041
* "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
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******** ******@TK2MSFTN GP09.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
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.c om> wrote
in message news:%2******** ********@TK2MSF TNGP09.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******** ******@TK2MSFTN GP09.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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4118
by: Jody Gelowitz | last post by:
I am trying to find the definition of "Safe Printing" and cannot find out exactly what this entitles. The reason is that I am trying to print contents from a single textbox to no avail using the PrintDialog control under a security setting with only SafePrinting allowed. I have attached a sample project that I am using to try to accomplish this. The print dialog appears, but when I press the Print button, I get an exception (at the end...
3
2291
by: Bryan Z | last post by:
I was wondering how do you print just part of a webform in asp.net -- like just printing the contents of a textbox or label. I know that it will involve javascript, but I cannot get the javascript function to work. Basically, this is the scenario --- A simple web page with a search form. User enters search value, and a datagrid displays what the search returns with a template column to link to the details of each record found. ...
2
4531
by: freddy | last post by:
I am new to c#, I am trying to print the context of a textbox or a combobox.
5
12823
by: Tom | last post by:
I am converting an old application that was printing directly to a specialized printer device (i.e. a special label printer). It was doing this by opening a file with the file path of 'LPT1:' and then using PRINT # to print directly to the printer device. Obviously, this is not going to work under VB.NET - StreamWriter won't let you open a device like LPT1: and such. I assume I am going to have to switch to the System.Drawing.Printing...
7
6037
by: Jonathan Smith | last post by:
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.
6
14931
by: randy1200 | last post by:
I'm using Visual Studio 2005 and C#. I need to print a WinForm used for data entry as a graphic. In other words, I need to print the exact WinForm the user sees on the screen. I searched through the newsgroups, and found the code below. This seems reasonable, except for the fact that the author does not provide his SetSeq_Library. This is needed to load the Bitmap variable _ActiveFormImage. Any suggestions on how to capture a WinForm...
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9939
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4040
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2870
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.