HTML file handling/modification in Visual Basic .NET application

  • Thread starter Thread starter Jay Kim
  • Start date Start date
J

Jay Kim

Hi,
We're implementing a Windows application using Visual
Basic .NET.
One of the key features we need to implement is that we
should be able to get the accurate byte offset of user
selected text in the file.
We've been trying to use the RichTextBox control to load
a file, and get the offset when the user selects some
text in the file. It's been working ok with regular text
files, but we can't use the RichTextBox control to handle
an HTML file.
We're looking for a control that loads a HTML file,
displays it correctly like web-browser, and
1. can get(return) actual position or byte offset
of user selected text
OR
2. has a feature to allow us to modify HTML source,
and put some tags into the specific location, which user
selected

We want to keep the original HTML source as much as
possible if we need to put our own tags into the file to
remember the selected location.
We've tried some third-party controls that can load HTML
file in VB form, but none of them have the features that
we need, and some of them have some issues like modifying
(converting) original HTML source which we don't want.
Please let us know how to implement this.

Thanks.
 
Hi,

Thanks for your post. As I understand, you want to create a HTML designer
of you own which is able to edit the HTML source and view the result within
your application. Please correct me if there is any misunderstanding. Now
I'd like to share the following information with you:

1. Based on my experience, I suggest you to create two views in your
application. One is a text editor for a user to edit HTML source; the other
hosts a web browser control which displays the result of the edit view.
Just like IE where I can edit the source outside say, Word, Notepad,
FrontPage, etc.

The following articles describes using Web Browser in C# and VB.NET:
http://www.c-sharpcorner.com/Internet/WebBrowserInCSMDB.asp

2. If you want a WYSIWYG HTML designer control like those in Visual Studio
..NET IDE, ProntPage, etc, I did a search on www.google.com but did not find
an existing control. We are able to implement one ourselves by applying the
HTML specification, however, it is a time-consuming task and I do not
recommend.

HTML 4.01 Specification
http://www.w3.org/TR/html4/

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Tian Min,

Thanks for your response.
Actually, we're not looking for a HTML designer
implementation.
In our application, users see a HTML page(not the source)
just like you see a HTML file in any web browser.
And, when users select some text from anywhere in HTML
viewer, WebBrowser control, HTML control or whatever, we
need to be able to get the exact location of selected
text, so that we can store the offset or something to
reuse it next time.
So, if there is a way to get the exact location(offset)
of selected text, we can then modify the source to put in
a ID tag or something that represent the text has been
selected by user.
Am I addressing our issue clearly? Please let me know.
Thanks again.

Jay

-----Original Message-----
Hi,

Thanks for your post. As I understand, you want to create a HTML designer
of you own which is able to edit the HTML source and view the result within
your application. Please correct me if there is any misunderstanding. Now
I'd like to share the following information with you:

1. Based on my experience, I suggest you to create two views in your
application. One is a text editor for a user to edit HTML source; the other
hosts a web browser control which displays the result of the edit view.
Just like IE where I can edit the source outside say, Word, Notepad,
FrontPage, etc.

The following articles describes using Web Browser in C# and VB.NET:
http://www.c- sharpcorner.com/Internet/WebBrowserInCSMDB.asp

2. If you want a WYSIWYG HTML designer control like those in Visual Studio
.NET IDE, ProntPage, etc, I did a search on
www.google.com but did not find
 
Hi Jay,

Thanks for your feedback. As you know, the web browswer will tranlate the
HTML tags and render the content in its view. When a user select some text
anywhere in HTML viewer, I suggest that you may need to get both the
content and coordinate of the text in the HTML viewer and then search it in
the HTML file.

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Jay,

Thanks a lot for your information. I am very glad to hear that Peter's
suggestion will help you! If you have any problems, please feel free to
post in the thread in dotnet.languages.vb or to this thread.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top