borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Restarting Windows)Next Topic (Text file to MDB table) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Find Text in TextBox with HTML Source String Ignoring HTML tags
Poster Message
malibog_ka_ba2003
Level: Trainee

Registered: 01-03-2005
Posts: 2

icon Find Text in TextBox with HTML Source String Ignoring HTML tags

Dim L As Integer, R As Integer, Start As Integer
Dim FindText As String, ReplaceText As String

Start = 1

Text1.SetFocus
L = InStr(1, Text1.Text, "<", 3)
R = InStr(1, Text1.Text, ">", 3)


Do While R > 0
    R = InStr(Start, Text1.Text, ">", 3) 'start searching at the end of <HTML">" and save the position
    DoEvents
    
    Do While L > 0
        L = InStr(R, Text1.Text, "<", 3) - 1 'save position of "<"
        
        If L < R Then Exit Do 'end of text
        
        Text1.SelStart = R          'The cursor is in between ><
        Text1.SelLength = (L - R)   'Highlight the text in between HTML >< tags
        
        '=================================================================
        ' In this section the code will loop through the highlighted text
        ' and find the needed text and replace it if found. I can start at
        ' position R but I don't know how to stop at position L.
        ' I'm totally trap in this section. I NEED HELP IN THIS SECTION!
        '
        ' Do While InStr(R, Text1.Text, Text2.text, 3) > 0 'Loop through Highlighted text
        '       'Replaced found text if any
        '       'If no text has found the InStr(R, Text1.Text, Text2.text, 3) will
        '       'return the next nearest match outside the Highlighted text
        '       'I want to Exit Do if no Text2.text match
        ' Loop
        '
        '=================================================================
        Start = R + 1   'start searching in the most recent position or after Highlighted text
        DoEvents
        Sleep (1500)
        Exit Do
    Loop
Loop

03-03-2005 at 09:36 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : Find Text in TextBox with HTML Source String Ignoring HTML tags
Previous Topic (Restarting Windows)Next Topic (Text file to MDB table) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder