I'm using a WPF Textbox in Winforms using elementhost to get the SpellChecker feature. I loaded a large text file with at least 100,000 + characters and over 2,000 lines. It opens the file and adds the text to the wpf textbox normally and I can easily scroll through the textbox. When I minimize the program while I've loaded this document, the program gets stuck and it takes quite a while atleast 1 minute(or more sometimes) to maximize back. Nothing wrong with the document or the way the program open the document I just don't understand what's wrong with it. What can be the problem if so, is anyone able to solve this.
I debugged the program and there are no debug errors just performance I guess but it loads and opens fine just when I minimize.
Code for Opening a File:
'' Dim WpfTest1 As New sp.Tb Dim ElementHost1 As System.Windows.Forms.Integration.ElementHost = Me.Controls("ElementHost1") Dim TheTextBox As System.Windows.Controls.TextBox = CType(ElementHost1.Child, Tb).ctrl_TextBox '' Dim OFD As New OpenFileDialog OFD.Title = "Open" OFD.Filter = "Text Documents (*.txt) | *.txt|All Files |*.*" If OFD.ShowDialog = Windows.Forms.DialogResult.OK Then Using sr As New StreamReader(OFD.FileName, Encoding.Default) TheTextBox.Text = sr.ReadToEnd Var.SaveLocation = OFD.FileName sr.Close() Var.MadeChanges = False lbl_LastSaved.IsLink = True End Using Me.Text = System.IO.Path.GetFileNameWithoutExtension(OFD.FileName) + " - " + ProductName lbl_LastSaved.Text = "Last Saved " + System.IO.File.GetLastWriteTime(Var.SaveLocation).ToString("f") SaveRecentFile(Var.SaveLocation) End If
Edited 1 Year Ago by deceptikon: Moved to VB.NET