Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 967641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:21:06+00:00 2026-05-16T02:21:06+00:00

I am running a index search on a string in a rich textbox, i

  • 0

I am running a index search on a string in a rich textbox, i have a list of keywords which need to be a different color in this textbox. how do i run a search on a string in vb2005 and get a list of indexes where the text matched my search?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:21:06+00:00Added an answer on May 16, 2026 at 2:21 am

    Here is a fairly simple solution. Note that it will find the word “our” in “Four”. If that is not desirable you can write something to eliminate overlapping matches.

    Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim SearchText As String = "One Two Three Four"
    
        Dim Keywords As String() = {"One", "Four", "our"}
    
        Dim WordMatches As New Generic.List(Of WordMatch)
    
        For Each KeyWord As String In Keywords
            Dim i As Int32 = 0
    
            While i <> -1
                i = SearchText.IndexOf(KeyWord, i, System.StringComparison.OrdinalIgnoreCase)
    
                If i <> -1 Then
                    Dim MyMatch As New WordMatch
                    MyMatch.CharIndex = i
                    MyMatch.Word = KeyWord
                    WordMatches.Add(MyMatch)
                    i += KeyWord.Length
                End If
            End While
        Next
    End Sub
    
    Private Structure WordMatch
        Public CharIndex As Int32
        Public Word As String
    End Structure
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In running this on index.html, I get the following error: Uncaught SyntaxError: Unexpected token
I got this jQuery pre-loading script running on a index.html page loading about 10Mb
I have an IIS server which serves a search page using SolrNet. The search
We're running Solr 3.4 and have a relatively small index of 90,000 documents or
I'm trying to append /index.html to some folder paths in a list like this:
I have a site running Plone 4.1 which has a custom content type developed
I have a table with about 1000 cities. Sometimes, I need to search by
Running the command generates new rails projects: $ rails generate controller home index The
Why the 'index' always return value 0 although the ticker running and there is
I am getting the following error after running git svn rebase: 'update-index --refresh: command

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.