Displaying paragraphs of text in a Label

kumaraswamy

Member
Joined
Jul 24, 2009
Messages
12
Programming Experience
1-3
Hi
It would be of great help to me if someone can help me with this issue:

I want to read from a text file and display it in a label. However, when I do that, I see that there is no word wrapping. In the sense, a whole paragraph is displayed in one line and the next one in the next line and so on. Can some one please tell me how to read text from a file and make it display as it is (lines as they are)? I am using the following code right now:

Imports Microsoft.Office.Tools.Word
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Interop.Word

Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strFileName As String
strFileName = "C:\Baba\check1"
Dim WordApp As New Microsoft.Office.Interop.Word.Application
WordApp.Visible = False
Dim WordDoc As Microsoft.Office.Interop.Word.Document
TextBox1.Multiline = True
WordApp.Visible = False
WordDoc = WordApp.Documents.Open(strFileName)
WordApp.Visible = False
Label1.AutoSize = True
'Label1.Wordwrap = True
Label1.Text = WordDoc.Content.Text
'MessageBox.Show(WordDoc.Content.Text)



End Sub

Thanks
Kumar
 
Back
Top