Favorites/Registry Help Needed!

I am making a web browser in C#. I need help doing the favorites. I got as far as populating the favorites menu with a list of values from the "LocalMachine\Software\WebBrowser" key.Now how can I make the browser navigate to the clicked menu

Heres what I got for the App to load the list of values:

RegistryKey key = Registry.LocalMachine.OpenSubKey("Software\\WebBrowser", true);

private static void Form1_Load(object sender, EventArgs e){
RegistryKey RK = Registry.LocalMachine.OpenSubKey("Software\\WebBrowser");
if(RK != null){
string[] valNames = key.GetValueNames();
foreach (string x in valNames){
favoritesToolStripMenuItem.DropDownItems.Add(key.GetValue(x).ToString(), Web_Browser.Properties.Resources.window_new, matt_Click);

}
}

else{
RegistryKey key = Registry.LocalMachine.OpenSubKey("Software", true);
RegistryKey newkey = key.CreateSubKey("WebBrowser");
}
}

private void matt_Click(object sender, EventArgs e)
{
WHAT DO I ADD HERE
}

Matt


Answer this question

Favorites/Registry Help Needed!

  • Alien72

    Hi,

    In your code, I noticed that your using a ToolStripMenuItem object. What I would Suggest is handling the Dropdownbutton's DropDownItemClicked event. This event triggers whenever a user clicks one of its dropdownitem.

    You code might look like this:

    private void toolStripDropDownButton1_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) {
    ToolStripMenuItem item = (ToolStripMenuItem)sender;
    wb.Navigate(item.Text);
    }

    Well, this code is pretty much straight forward. You can check the item.Text if it has a valid http address.

    cheers,

    Paul June A. Domag



  • Jim Altrichter

    Hi,

    If your trying to create a webbrowser then I assume that your using the WebBrowser control

    If so, just use the Navigate method of the Webbrowser ro go to the specified url.

    WebBrowser1.Navigate("your url from the favorites menu");

    cheers,

    Paul June A. Domag



  • Will Durning

    How do I get the URL from the favorites menu

  • Favorites/Registry Help Needed!