Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Richtextbox ocx bug with plain text insert?

Posted on 2004-04-19
6
Medium Priority
?
451 Views
Last Modified: 2013-12-26
I have encountered a strange problem with RichTextbox OCX.

I'm using it as a base for a source editor, in order to colorize tokens etc. I'm using VB6.

With certains text sources(no rtf, just plain text) inserting a char in editor and then call
DocLen = len(RichTextBox.text)
give me a DocLen value increased of 3 units (instead of 1 that I espect  as i've inserted only one char) and I found that somewhere after that line it has added a vbcrlf char (this can be 10, or 20 or more lines after insertion point)

This strange behaviour make my multi-level undo class to fail since it thinks that I've replaced some text and not just inserted one (since i've digited only one char that is not vbcrlf and docLen is increased by 3)

Thanks for any help
0
Comment
Question by:fabiobond
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 10862586
How are you inserting the text into the RichTextbox?

Idle_Mind
0
 

Expert Comment

by:cnfei
ID: 10865019
Try to initialize the RichTextBox.text in form load to make sure there is nothing in the rich text box.


Private Sub Form_Load()
    RichTextBox.Text = ""
End Sub
0
 

Author Comment

by:fabiobond
ID: 10866776
Please downloand this demo project to realize what the bug is.

If you load the testdoc1.bb all works fine, but if you load the testlong.bb file you will find that during RichTextBox Change Event len(RTB.Text) returns strange values!

Download test project here:
http://www.beggi.it/roccia/downloads/RTBBug.zip
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Accepted Solution

by:
cnfei earned 1500 total points
ID: 10867163
I have downloaded your program and try to run by using both of the files.

I found that the result is normal.
Both of them return correct length when i change the RTB value.

The testdoc1.bb got 573 characters
The testlong.bb got 233065 characters
0
 

Author Comment

by:fabiobond
ID: 10867555
On my Pc I get

575 characters for testdoc1.bb (this should be correct since from file properties tab i read it's size is 575 bytes)
233068 characters for testlong.bb

in testlong.bb, the onchange event is called every time i insert a character but the value of txtDocLen sometimes remain unchanged between keystrokes and sometimes increases of more than a unit.

At this point I think there is some problem with my installation


What should I try? What to reinstall? I've WinXP Pro (no SP1) and OfficeXP Pro.
0
 

Author Comment

by:fabiobond
ID: 10868189
I've installed XP service pack 1 and now the control works as it should be

Thanks cnfei for your time
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question