Solved

RichTextBox.Find method strt/end integer arguments

Posted on 1997-04-03
3
173 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
add text to end of existing text in file 16 70
MS Access Search and Replace Using VBA 6 69
Add and format columns in vb6 7 55
Macro Excel - Multiple If conditions 2 71
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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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 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…

816 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

8 Experts available now in Live!

Get 1:1 Help Now