Just for what it's worth:
I was has having some strange behavior using a RichTextBox(RTB ).
What I was doing was I was loading some text into a RTB and and into an
object that would let me do searches on that text returning the
locations where the search text was found. I could then select and
change the color in the RTB. The colored text did not match up to the
search text.
What I found was that the RTB.Text before load does not equal RTB.Text
after load. It appears that before load each text line is terminated
with a CR & LF and after loading the text line is only terminated with
LF. So I was using before load to do the search and trying change the
color on after load text.
Jorge de Cardenas
---- CODE ------------------
public class Form1 : System.Windows. Forms.Form
{
private mshtml.IHTMLDoc ument2 page;
private string beforeLoad;
private System.Windows. Forms.RichTextB ox rtBox;
private System.Componen tModel.IContain er components;
public Form1()
{
InitializeCompo nent();
string strUrl;
strUrl = @"D:\My Documents\test. html";
// open HTML document returns a IHTMLDocument2
page = doc.get_HTML_Do cument(strUrl);
this.rtBox.Text = page.body.inner Text;
beforeLoad = this.rtBox.Text ;
}
#region Windows Form Designer generated code
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run (new Form1());
}
private void Form1_Load(obje ct sender, System.EventArg s e)
{
// This does not equal beforeLoad even though they both come from
the RTB
string afterLoad = this.rtBox.Text ;
}
}
}
I was has having some strange behavior using a RichTextBox(RTB ).
What I was doing was I was loading some text into a RTB and and into an
object that would let me do searches on that text returning the
locations where the search text was found. I could then select and
change the color in the RTB. The colored text did not match up to the
search text.
What I found was that the RTB.Text before load does not equal RTB.Text
after load. It appears that before load each text line is terminated
with a CR & LF and after loading the text line is only terminated with
LF. So I was using before load to do the search and trying change the
color on after load text.
Jorge de Cardenas
---- CODE ------------------
public class Form1 : System.Windows. Forms.Form
{
private mshtml.IHTMLDoc ument2 page;
private string beforeLoad;
private System.Windows. Forms.RichTextB ox rtBox;
private System.Componen tModel.IContain er components;
public Form1()
{
InitializeCompo nent();
string strUrl;
strUrl = @"D:\My Documents\test. html";
// open HTML document returns a IHTMLDocument2
page = doc.get_HTML_Do cument(strUrl);
this.rtBox.Text = page.body.inner Text;
beforeLoad = this.rtBox.Text ;
}
#region Windows Form Designer generated code
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run (new Form1());
}
private void Form1_Load(obje ct sender, System.EventArg s e)
{
// This does not equal beforeLoad even though they both come from
the RTB
string afterLoad = this.rtBox.Text ;
}
}
}