C# HtmlHistory and Favorites


I have an urgent project that I am working on that incorporates the web browser control. To finish this element I need to get both the favourites bar and history info working. I figure the HtmlHistory class will solve my history problems but can't get it to work. Should I be instantiating or creating my own class first?
Next is the favourites bar. I have access to an SQL server which I intend to use for storing links but can't figure out how I can allow the user to create sub folders. Is there an easier solution? Perhaps something similar to HtmlHistory.

Any help would be greatly appreciated. If you can't tell I am fairly new to C#.


John Walden
Who is Participating?
Bob LearnedConnect With a Mentor Commented:
1) This was fun to find an answer for:

  The constructor for HtmlHistory is sealed, so it needs to be accessed from some other class within the framework

2) I found this:

3) There isn't anything similar for Favorites that I know of, but with Windows you can look in the configured Favorites folder for the files.

Bob LearnedCommented:
1) What have you tried so far with the HtmlHistory?

2) Are you getting any exceptions?


johnwalden869050Author Commented:

Just figured it out. I was being a bit dumb - its been a long day :-)

The code that it is working with is:

        private void ListHistory()
            string History;
            HtmlHistory hh;
            hh.(whatever i need)

At least I think this is going to work!

Thanks all the same. Do you have any ideas on the favourites ???


Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

johnwalden869050Author Commented:
Scap that! Still dosen't work.

To answer your question...

I have tried the usual... HtmlHistory hh = new HtmlHistory(); -  Error: The type 'System.Windows.Forms.HtmlHistory' has no constructors defined
Also I have made my own class using the syntax from MSDN ... public sealed class HtmlHistory : IDisposable - No Joy.
And finally the one above.

All the best

levyukConnect With a Mentor Commented:
Aren't favorites simply shortcuts to web addresses which are stored in the PC. I don't think you could do this simply by using a database and would advise against it especially with your idea of using sub folders. It would be much easier if you stored the favorites in a file on the local computer. Maybe you could store them in an XML file so that they can be used on any machine and in any application. Would make transport of favorites easier.

Just some ideas, hope they help

johnwalden869050Author Commented:
Bob, Jon

Thanks for that Bob - it works perfectly! 450 Points awarded.


I had already considered the XML theory but don't have any experience creating or even reading from XML. I was hoping to avoid it but it looks like I will just have to grin and bear it!

Thanks for your input - 50points.


johnwalden869050Author Commented:

One last thing, I know the question is closed...

Any suggestions on how I can get the drop down list to populate for the history buttons. HtmlHistory doesn't offer any avenues...


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.