|
-
Apr 28th, 2017, 02:13 PM
#1
Thread Starter
Lively Member
RichTextBox: Loop Line by Line Looking for Criteria and Replace Certain Line
Hi everyone,
Need some guidance on best way to loop through a RichTextBox line by line, and if the line meets a certain criteria format like “[PatientRecord###], then replace that line’s text with new [PatientRecord###].”
The issue now is that several Patient Record numbers are the SAME – for example, we have three [PatientRecord497]. Therefore, that limits the usefulness of an GetPrivateProfile API call which will grab only the first matching entry or using a generic Replace$ on the RichTextBox that again will only replace the first matching entry. So basically, thinking of maybe using almost a brute force approach that sets up a counter, starts at the beginning of the RichTextBox, and when it matches a “[PatientRecord###]” format force the first match to be “[PatientRecord001]”, increment the counter, and then the next match to be “[PatientRecord002]”, etc. Any sample code or logic advice greatly appreciated!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|