Adding large amounts of text to a readonly TextBox

  • Thread starter Thread starter Dennis C. Drumm
  • Start date Start date
D

Dennis C. Drumm

What is the best way to add several pages of text to a readonly TextBox? The
text does not change and was created in a Word rtf document but could as
easly be put in a ASCII text file. Can this be done using a resource or
something? Can TextBoxes be attached to data sources other than database
objects?

Thanks,

Dennis
 
Dennis,

You could put it into a resource, but ultimately, you have to get the
contents out of the resource into a string to add to the text. In order to
append large amounts of text, you will want to use the AppendText method on
the TextBox (or RichTextBox) class. It is meant to add large amounts of
text in an efficient manner.

Hope this helps.
 
Nicholas:

I had remembered talking to someone who mentioned using resouces to hold
literals, etc.

Now maybe you could point me in the right direction on how to do that. Is
there something in the MSDN docs that explains how to do this and then how
to get the text out after?

Thanks,

Dennis

Nicholas Paldino said:
Dennis,

You could put it into a resource, but ultimately, you have to get the
contents out of the resource into a string to add to the text. In order to
append large amounts of text, you will want to use the AppendText method on
the TextBox (or RichTextBox) class. It is meant to add large amounts of
text in an efficient manner.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Dennis C. Drumm said:
What is the best way to add several pages of text to a readonly TextBox? The
text does not change and was created in a Word rtf document but could as
easly be put in a ASCII text file. Can this be done using a resource or
something? Can TextBoxes be attached to data sources other than database
objects?

Thanks,

Dennis
 
Hi Dennis,

I think you can first embed it as resource the assembly, do something like
this:
http://www.devx.com/dotnet/Article/10831/0/page/2

Then you can get the resource from the assembly using
Assembly.GetManifestResourceStream method

Hope this helps,

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Dennis C. Drumm" <[email protected]>
| References: <OFkBFT#[email protected]>
<#9tDN4#[email protected]>
| Subject: Re: Adding large amounts of text to a readonly TextBox
| Date: Fri, 31 Oct 2003 15:49:29 -0500
| Lines: 50
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: vsat-148-63-14-234.c001.g4.mrt.starband.net
148.63.14.234
| Path:
cpmsftngxa06.phx.gbl!cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.
phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:195832
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Nicholas:
|
| I had remembered talking to someone who mentioned using resouces to hold
| literals, etc.
|
| Now maybe you could point me in the right direction on how to do that. Is
| there something in the MSDN docs that explains how to do this and then how
| to get the text out after?
|
| Thanks,
|
| Dennis
|
in
| message | > Dennis,
| >
| > You could put it into a resource, but ultimately, you have to get
the
| > contents out of the resource into a string to add to the text. In order
| to
| > append large amounts of text, you will want to use the AppendText method
| on
| > the TextBox (or RichTextBox) class. It is meant to add large amounts of
| > text in an efficient manner.
| >
| > Hope this helps.
| >
| >
| > --
| > - Nicholas Paldino [.NET/C# MVP]
| > - (e-mail address removed)
| >
| > | > > What is the best way to add several pages of text to a readonly
TextBox?
| > The
| > > text does not change and was created in a Word rtf document but could
as
| > > easly be put in a ASCII text file. Can this be done using a resource
or
| > > something? Can TextBoxes be attached to data sources other than
database
| > > objects?
| > >
| > > Thanks,
| > >
| > > Dennis
| > >
| > >
| >
| >
|
|
|
 
Back
Top