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 Button
s and a ListBox
.
For basic operation on the registry use the microsoft.win32
namespace, then we need to declare the following types:
RegistryKey MyReg ;
string [] names;
The first button will fill the ListBox
with all the typed URLs, and its code will go like this:
private void button1_Click(object sender, System.EventArgs e)
{
listBox1.Items.Clear();
MyReg = Registry.CurrentUser.OpenSubKey("Software\\Microsoft" +
"\\Internet Explorer\\TypedURLs",true);
names = MyReg.GetValueNames();
for(int i=0;i< names.Length;i++)
listBox1.Items.Add(MyReg.GetValue(names[i]));
}
Then if u choose a URL and click on the Delete button, the following code will execute:
private void button2_Click(object sender, System.EventArgs e)
{
if(listBox1.SelectedIndex != -1)
{
MyReg.DeleteValue((string)names[listBox1.SelectedIndex]);
listBox1.Items.Remove(listBox1.SelectedItem);
}
else
MessageBox.Show("Please choose a URL to be deleted");
}
References