none
How to display text file in label.

    Question

  • Hi does anyone know how to display a text file's content in a label, whilst keeping the formatting the same (ie. paragraphs, formatting, etc). This is because when I try the label does not display the text as it is layed out in the text file.
    Wednesday, March 26, 2008 9:14 PM

Answers

  • For this scenario, it may be better to consider using a TextBox with the properties modified so that it "looks like" a label.

     

    For example:

     

    Code Snippet

    TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None

    TextBox1.BackColor = System.Drawing.SystemColors.Control

    TextBox1.Multiline = True

    TextBox1.TabStop = False

    TextBox1.WordWrap = your choice

    TextBox1.ScrollBars = your choice

     

     

    Wednesday, March 26, 2008 10:45 PM

All replies

  • For this scenario, it may be better to consider using a TextBox with the properties modified so that it "looks like" a label.

     

    For example:

     

    Code Snippet

    TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None

    TextBox1.BackColor = System.Drawing.SystemColors.Control

    TextBox1.Multiline = True

    TextBox1.TabStop = False

    TextBox1.WordWrap = your choice

    TextBox1.ScrollBars = your choice

     

     

    Wednesday, March 26, 2008 10:45 PM
  • Hi, thanks for your reply. I did think of using this method, but the problem is that I want the text to be crawlable by the search engine, so that it is indexed.  I think if the text was in a textbox, then the search engine would not  be able to read it.
    Thursday, March 27, 2008 7:39 PM
  • I was also wondering how they go about displaying the text in these forum posts, as the formatting is kept the same when displayed.
    Thursday, March 27, 2008 7:41 PM
  • > Hi, thanks for your reply. I did think of using this method, but the problem is that I want the text to be crawlable by the search engine, so that it is indexed.  I think if the text was in a textbox, then the search engine would not  be able to read it.

     

    Oh... I thought you were talking about the Windows Forms controls.  ASP.NET actually has a totally separate forum system:  http://forums.asp.net/ You should try asking your question there.

     

     

     

    Thursday, March 27, 2008 11:14 PM