CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2001
    Posts
    155

    search for..............

    This isn't the same as before. I am making a debugger, and i need to know: When the user clicks a button it searches. If it finds the text it's looking for, it highlights it and scrolls to where the text is. How do i do that?

    --Ant
    --------------------------------------------------
    check out my newest freeware
    E-mail me at: [email protected]
    for the address

  2. #2
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: search for..............

    What are you searching? A text file,a DataBase, a textBox a RichTextBox, a ComboBox, a Listbox or what?

    John G

  3. #3
    Join Date
    May 2001
    Posts
    155

    Re: search for..............

    A richtextbox

    --Ant
    --------------------------------------------------
    check out my newest freeware
    E-mail me at: [email protected]
    for the address

  4. #4
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: search for..............

    To search a RichTextBox, use its .Find method. There is an option on the .Find that will highlight the found text.
    MSDN Help discusses the various options. Search on "Find Method" (Without the quotes of course) to locate it.


    John G

  5. #5
    Join Date
    Jul 2001
    Location
    Northern Hemisphere
    Posts
    14

    Re: search for..............

    Try this code dude!!

    Dim pos As Integer
    Dim target As String

    target = "xyz" 'What ever string you are searching for

    pos = InStr(0, RichText1.Text, target)

    If pos > 0 Then
    RichText1.SelStart = pos - 1
    RichText1.SelLength = Len(target)
    RichText1.SelColor = vbRed
    RichText1.SelBold = True
    End If

    .... so lemme know if it works dude!!!

    AnkewDude!

    There is no Genius without a touch of madness!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured