G
Guest
Still working on this HTML Editor control. I have a problem when the user
selects some hyperlinks. Sometimes the selection includes other tags. I
figured that I could use movestart and moveend functions to re-select just
the hyperlink.
As an example, the txtRangeobject contains something like:
<FONT face=Verdana size=1><A href="http://test.com">Click to View</A></FONT>
I have tried multiple solutions.
First I tried to use the findtext function but it would not find "<A
href="http://test.com">Click to view</A>"
oTxtRange = DirectCast(oSelection.createRange(), mshtml.IHTMLTxtRange)
Dim bFound as boolean=oTxtRange.findText("<A.....")
if bFound=true then oTxtRange.Select()
The code above never finds the Text I'm looking for...
I then tried to narrow the selection by using movestart.
Dim nPos As Integer = oTxtRange.moveStart("character", 10)
I was expecting this code to move the start of the selection 10 characters.
however, what it did was reset the HTMLText and text to nothing. MoveEnd did
the same..
Can you tell me how I can easily reselect the child element?
Thanks
Jason
selects some hyperlinks. Sometimes the selection includes other tags. I
figured that I could use movestart and moveend functions to re-select just
the hyperlink.
As an example, the txtRangeobject contains something like:
<FONT face=Verdana size=1><A href="http://test.com">Click to View</A></FONT>
I have tried multiple solutions.
First I tried to use the findtext function but it would not find "<A
href="http://test.com">Click to view</A>"
oTxtRange = DirectCast(oSelection.createRange(), mshtml.IHTMLTxtRange)
Dim bFound as boolean=oTxtRange.findText("<A.....")
if bFound=true then oTxtRange.Select()
The code above never finds the Text I'm looking for...
I then tried to narrow the selection by using movestart.
Dim nPos As Integer = oTxtRange.moveStart("character", 10)
I was expecting this code to move the start of the selection 10 characters.
however, what it did was reset the HTMLText and text to nothing. MoveEnd did
the same..
Can you tell me how I can easily reselect the child element?
Thanks
Jason