Solved

RichTextBox.Find method strt/end integer arguments

Posted on 1997-04-03
3
171 Views
Last Modified: 2012-08-13
How do I get around the RichTextBox.Find methods integer start argument when I want to find a string with the cursor being past the 32k mark? I am using this with a 'find' and a 'find next' type menu command. (like in all text editors)
0
Comment
Question by:cristopher
3 Comments
 
LVL 1

Expert Comment

by:YiannisVolos
ID: 1425028
Hello i am YiannisVolos. My answer for your question. I designed a special code for making FindNext(Find). It makes the same work. If you want you can change the given code, if you make changes which make it more powerful please e-mail it to me. Thank you.

In your button click paste the following source code.(the code is visual basic).
-S-T-E-P-S------------------------------------------------------------------------------------
a) add a textbox on a form.
b) add a command button
c) and a RichTextBox that it will contain the text of your user
---------------------------
StartFind:
If TextBox.Text <> "" Then
FoundPosition = InStr(Start + 1, UCase$(HomeEditor.richtextbox1.Text), LCase$(TextBox.Text))
If FoundPosition <> 0 Then
richtextbox1.SelStart = FoundPosition - 1
richtextbox1.SelLength = Len(TextBox.Text)
Start = FoundPosition
Else


If TestTimes = 1 Then
Response = MsgBox("Your program could not find the given text.", 0, "Your program title - Error Message")
Start = 0
Else
Start = 0
TestTimes = 1
GoTo StartFind
End If
End If
End If








my email: volosm@cytanet.com.cy
please increase the award points
0
 

Author Comment

by:cristopher
ID: 1425029
Your solution is the same as mine. It will not work over 32k. Could it be that the SelLength and SelStart properties of the RichtextBox are integers also?
0
 

Accepted Solution

by:
thalem earned 100 total points
ID: 1425030
Use Long instead of integer. I've done it, and it works well.
There is therefore no 32k limitation. Yeap. It's that simple.

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now