473,379 Members | 1,167 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Changing the Selection of iHTMLTxtRange

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

May 10 '06 #1
2 4424
Hi Jason,

Thanks for your post!

Based on the MSDN link below, "You can modify the extent of the text range
by moving its start and end positions with methods such as
IHTMLTxtRange::move, IHTMLTxtRange::moveToElementText, and
IHTMLTxtRange::findText."
http://msdn.microsoft.com/workshop/b...aces/txtrange/
txtrange.asp

For efficiency purpose, can you please provide a little sample project to
demonstrate the problem? Then I will review your project and give it a
research.

Thanks

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

May 10 '06 #2
Hi Jason,

Have you received my reply? Is your problem resolved? Thanks

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

May 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John Ryan | last post by:
I've a small bit of javascript on my site that has a from with 2 selection boxes, when you choose an option in the first box, the second one re-populates its list accordingly. But the second...
5
by: aqualizard | last post by:
I have searched and searched and searched... Can someone please tell me how (or "if" it is even possible) to change selected text in a textarea? Specifically, say a user has highlighted "ppl"...
2
by: S P Arif Sahari Wibowo | last post by:
Hi! Do you know how to put a form's Access-Visual-Basic-code that will force the form to be inserted, while the user has not type anything in the form, without changing focus, selection, etc.? ...
2
by: Alpha | last post by:
I have a window application. On one of the form, there is a listbox and a few combox. The lstSchItem has a dataview as a datasource. The comboxes are bind to its selected value but through the...
0
by: Tobin | last post by:
I am new to ASP.NET 2.0 and am redesigning some web pages developed in classic ASP. A common task was for me to accept input of text boxes and date controls to provide a filtered list for the...
0
by: =?Utf-8?B?Q29yZXlNY0s=?= | last post by:
I'm working on a TextBox control (in C# using .NET 2.0) that allows fields (like MS Office's mail merge feature). I want the editor to treat the field as though it was a single character. The user...
7
by: robtyketto | last post by:
Greetings, I'm slowly building up code to do the following:- Display TWO selection option boxes (cascading). If the FIRST selection option box changes then reload the jsp using onchange...
9
by: Brett_A | last post by:
I have a form where the first field is a dynamic drop-down that pulls from a db (Access). The fields associated with the query are task_id, task_name and task_rate. The field has the value of...
1
by: rbuczynski | last post by:
I've read two threads that have been closed in which a user posed the question, "Can I disable text selection using CSS?" The responses were either hopeless or critical of the inquirer. I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.