Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

light-nexus

Printing textboxes in VB.NET

This topic is 5554 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there. How do you print the contents of a textbox? I tried using a PrintDocument object, then using
  
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
       e.Graphics.DrawString(txtWindow.Text, 0, 0) 
End Sub
   
Where: txtWindow.Text is my textbox text. All this seems to do is print only one line of text, which isn't useful. It seems that though the textbox is multiline, it is still treated as a single-line string. Is there any way around this? [edited by - light-nexus on March 30, 2003 3:32:34 PM]

Share this post


Link to post
Share on other sites
Advertisement
Try one of the DrawString overloads that take a layoutRectangle and a StringFormat argument. Read the docs.



"If there is a God, he is a malign thug."
-- Mark Twain

Share this post


Link to post
Share on other sites
quote:

Original post by Arild Fines
Read the docs.



In the case of Microsoft finding the information you want can often be daunting. I find RTFM replies on questions to usually be off the mark.

I spent a good deal of time on Friday simply looking for a note on Excel automation on msdn.microsoft.com. It was, quite literally, a needle in the haystack.





[edited by - Talonius on March 31, 2003 9:35:10 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Talonius
In the case of Microsoft finding the information you want can often be daunting. I find RTFM replies on questions to usually be off the mark.


Perhaps, but in this case he knows exactly where to look: The DrawString methods on the Graphics class.

quote:

I spent a good deal of time on Friday simply looking for a note on Excel automation on msdn.microsoft.com. It was, quite literally, a needle in the haystack.


The automation model is documented in the Excel help file. On my machine and Office2K thats I:\Program Files\Microsoft Office\Office\1033\XLMAIN9.chm. Look for a topic called "Programming information".






"If there is a God, he is a malign thug."
-- Mark Twain

Share this post


Link to post
Share on other sites
Thanks for your help everyone. I guess DrawString is what I will use for now. About msdn.microsoft.com: It is indeed a haystack for any needle of information you need. If you search for something very simple, you get gobs of stuff you don''t need. I hardly ever use MSDN at all.

Later!

Share this post


Link to post
Share on other sites
quote:
Original post by light-nexus
About msdn.microsoft.com: It is indeed a haystack for any needle of information you need. If you search for something very simple, you get gobs of stuff you don''t need. I hardly ever use MSDN at all.


I suggest you keep trying to figure out how to use MSDN - it is well worth when you know how to find the stuff you need on there.

I can give you one little tip: Don''t use MS'' own search engine. Google is usually better, even for MSDN. Just put site:msdn.microsoft.com after your search criteria. That will limit the google search to the msdn pages.

That being said, it is usually faster and easier to find something in your local copy of the docs, especially since they have a proper index.



"Laughter means distance. Where laughter is absent, madness begins. The moment one takes the world with complete seriousness one is potentially insane. The whole art of learning to live means holding fast to laughter; without laughter the world is a torture chamber, a dark place where dark things will happen to us, a horror show filled with bloody deeds of violence."
-- Jens Bjørneboe

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!