473,320 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Unsual RichTextBox behavior

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.IHTMLDocument2 page;
private string beforeLoad;

private System.Windows.Forms.RichTextBox rtBox;
private System.ComponentModel.IContainer components;

public Form1()
{
InitializeComponent();

string strUrl;
strUrl = @"D:\My Documents\test.html";

// open HTML document returns a IHTMLDocument2
page = doc.get_HTML_Document(strUrl);

this.rtBox.Text = page.body.innerText;
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(object sender, System.EventArgs e)
{
// This does not equal beforeLoad even though they both come from
the RTB
string afterLoad = this.rtBox.Text;
}
}
}

Aug 30 '06 #1
0 952

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Walter L. Williams | last post by:
VS.NET 2K3 and .NET 1.1 I'm having a problem with RichTextBox allocating huge amounts of memory for text. I have recreated the problem in the attached sample which, when the button is pressed,...
0
by: Frank White | last post by:
I noticed what I thought was peculiar behavior when I used the RichTextBox. If you get the RTF string from a RichTextBox using the RichTextBox.Rtf property, the RichTextBox treats this as an action...
4
by: M O J O | last post by:
Hi, I'm using a RichTextBox with WordWrap=True and MultiLine=False. When the text is to long, it fills more lines. How do I get the number of lines the text uses? Thanks!
1
by: lottoman | last post by:
Hello All, The RichTextBox is not responding to click events. I created a new project dropped a RichTextBox. Private Sub RichTextBox1_Click(ByVal sender As Object, ByVal e As...
0
by: James Manila Dot Net | last post by:
I've been having a major problem using the Rtf property of the Richtextbox. I use the RTB to generate RTF code to save it in an access database. I'm successfully able to do this. However, the...
4
by: D. Yates | last post by:
Hi, When a RichTextBox control doesn't have focus, it DOES NOT scroll to the last line that is added; however, if it does have focus, it WILL scroll to the last line added. I want to stop and...
2
by: AWesner | last post by:
I am currently working to create a VB program that will do more detailed in-file text search functions than windows has to offer. I have a form with a RichTextBox control to display the text that...
0
by: TCook | last post by:
Hello All, First, I apologize for posting this to so many newsgroups but I wasn't sure which newsgroup was most appropriate nor which newsgroup would most likely have subscribers that have done...
1
by: JT | last post by:
Hi, I want to disable the ability to launch an application that is embedded in the text of a RichTextBox control. I've seen various posts that say that doing the following will disable click...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.