Open large rich text file smoothly
Hi
If there is any way to open large rtf files in rich text text box ?
when i try to open a large rtf file in rich text box it halt the system unlike windows word pad . win word pad open file smoothly may be read line by line how it possible in vb.net? http://www.kolobok.us/smiles/mini/chok_mini.gif
Re: Open large rich text file smoothly
Hey,
How large a file are we talking about here?
Can you show the code that you are currently using?
Gary
Re: Open large rich text file smoothly
vb Code:
With OpenFileDialog1
'Set the Filter Text to set the open file types
.Filter = "Urdu Files (*.urdu)|*.urdu|" & _
"Rich Text Files (*.rtf) |*.rtf"
'Pick Text Files to begin with
.FilterIndex = 1
'The Caption of your OpenDialog
.Title = "Choose a File To Open....."
'Ensure we only get back valid filenames
.CheckFileExists() = True
.CheckPathExists = True
.ValidateNames = True
.DereferenceLinks = True
'Set the starting dir
' .InitialDirectory = "c:\"
'Show the OpenDialog
.ShowDialog(Me)
TextBox1.AutoWordSelection = True
TextBox1.ScrollBars = RichTextBoxScrollBars.Vertical
TextBox1.WordWrap = True
If .FileName = "" Then GoTo line
TextBox1.LoadFile(.FileName, _
RichTextBoxStreamType.RichText)
End With
File Is Large Up to 5 MB
Re: Open large rich text file smoothly
Hey,
I am going out on a limb here (because I have never actually done this), but I suspect you could do the work of loading the file in a BackgroundWorker:
http://msdn.microsoft.com/en-us/libr...undworker.aspx
That way, your UI will still be usable by the end user.
Gary