Click here to Skip to main content
15,888,246 members
Articles / Programming Languages / C#
Article

Modify the list of typed URLs in IE

Rate me:
Please Sign up or sign in to vote.
1.60/5 (10 votes)
8 May 2005CPOL1 min read 47.3K   478   11   5
How to modify the list of typed URLs in IE.

Sample Image

Introduction

You can simply clear the typed URLs in IE by clicking on: Tools ---> Internet options ---> then Clear History. But it will be clear to anyone that you have deleted all your History. In this simple article, I will show you how to delete only specified URLs.

Using the Regedit

You can do this by using the regedit.exe program that helps you to edit in the registry. You can run this program by typing "regedit" in the Run command box. Then expand the following keys:

  • HKEY_CURRENT_USER
  • SOFTWARE
  • Internet Explorer
  • Typed URLs

This will display a list of values of all your typed URLs. This simple program will make this task easy and you will know the basic methods to access the registry which is the heart of Windows.

Using the code

The program is a simple Windows Form that contains two Buttons and a ListBox.

For basic operation on the registry use the microsoft.win32 namespace, then we need to declare the following types:

C#
// this is the basic class to deal with registry
RegistryKey MyReg ;
// this is a string array that
// will hold all the key names of a specified subkey
string [] names;

The first button will fill the ListBox with all the typed URLs, and its code will go like this:

C#
private void button1_Click(object sender, System.EventArgs e)
{
    // clear the listbox
    listBox1.Items.Clear();
    // use the regisry class to get the path to the specified subkey
    MyReg = Registry.CurrentUser.OpenSubKey("Software\\Microsoft" + 
            "\\Internet Explorer\\TypedURLs",true);
    // fill the array with all the names in this subkey
    names = MyReg.GetValueNames();
    for(int i=0;i< names.Length;i++)
        //fill the listbox with these entries
        listBox1.Items.Add(MyReg.GetValue(names[i]));
}

Then if u choose a URL and click on the Delete button, the following code will execute:

C#
private void button2_Click(object sender, System.EventArgs e)
{
    if(listBox1.SelectedIndex != -1)
    // check that there is an item is selected
    {
        // delete the value from registry
        MyReg.DeleteValue((string)names[listBox1.SelectedIndex]);
        // remove the item from the list
        listBox1.Items.Remove(listBox1.SelectedItem);
    }
    else
        MessageBox.Show("Please choose a URL to be deleted"); 
}

References

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Egypt Egypt
Mina Fawzi
Faculty of engineering Ainshams university In CAIRO
intersted in .net technology and DirectX

Comments and Discussions

 
Questionhow do i run this program Pin
wim012-Jun-09 3:36
wim012-Jun-09 3:36 
AnswerRe: how do i run this program Pin
MinaFawzi21-Jun-09 3:33
MinaFawzi21-Jun-09 3:33 
GeneralCute but ....... Pin
fwsouthern9-May-05 17:38
fwsouthern9-May-05 17:38 
GeneralRe: Cute but ....... Pin
MinaFawzi9-May-05 23:17
MinaFawzi9-May-05 23:17 
GeneralPorn trick Pin
Arch4ngel9-May-05 3:05
Arch4ngel9-May-05 3:05 
That seems like a trick to fool your mother or your girlfriend when you go see some porn online ! lollll

But it's plain easy and useful however Wink | ;)

Have fun with your *cough* web sites *cough*



If someone says "Die mortal!", don't stay to see if he isn't.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.