![]() |
Languages »
C# »
Samples
Intermediate
License: The Code Project Open License (CPOL)
Delete Links from the Recent Projects List on the Start Page of Visual Studio 2003, 2005 and 2008By Carlos Saraiva Jr.This application deletes links from the Recent Projects list on the Start page of Visual Studio 2003/2005/2008 |
C# 2.0.NET 2.0, Win2K, WinXP, Win2003, WinForms, VS.NET2003, VS2005, Dev, QA
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
This article describes how to delete links from the Recent Projects list in the Start page of Visual Studio 2003/2005/2008, by accessing registry keys and doing some operations like delete and changing them.
Some time ago, I wanted to eliminate some links from the Recent Projects list and I did not know how to do that. Searching the Web, I found articles describing how to delete them, but they all described a manual process: Open Regedit from Run..., etc.... So, I decided to write a small application to automate this task.
You could use this application or source code in your own application.
The first method is used to populate a ListView in a Form.
private void PopulateListView(string versaoVS)
{
RegistryKey regKey = Registry.CurrentUser;
regKey = regKey.OpenSubKey
("Software\\Microsoft\\VisualStudio\\" + versaoVS + "\\ProjectMRUList");
lstvRecentProjects.Items.Clear();
if (regKey == null) return;
foreach (string keyname in regKey.GetValueNames())
{
try
{
ListViewItem item = new ListViewItem();
item.Checked = false;
string kname = keyname;
string value = (String)regKey.GetValue(kname);
RegistryValueKind valuekind = regKey.GetValueKind(kname);
lstvRecentProjects.SmallImageList = imgList;
item.Text = ReturnTexto(value);
item.Tag = valuekind;
item.SubItems.Add(value);
item.ImageIndex = ReturnImageIndex(item.Text);
lstvRecentProjects.Items.Add(item);
lstvRecentProjects.Refresh();
}
catch (Exception ex)
{
MessageBox.Show("Exception: " + ex.Message +
"\r\nPlease report this Exception, " +
"mail to carlosaraiva@gmail.com!", "Exception",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
You could use this application or source code in your own application. The second method is used to delete a registry key after selecting a project or solution in the ListView and clicking the Delete button.
private void DeleteRegKey()
{
string versaoVS = null;
if (rdbVS2003.Checked)
versaoVS = "7.1";
if (rdbVS2005.Checked)
versaoVS = "8.0";
if (rdbVS2008.Checked)
versaoVS = "9.0";
try
{
RegistryKey regKey = Registry.CurrentUser;
regKey = regKey.OpenSubKey("Software\\Microsoft\\VisualStudio\\" +
versaoVS + "\\ProjectMRUList", true);
bool delete = false;
string name = "File";
if (regKey == null) return;
foreach (ListViewItem item in lstvRecentProjects.Items)
{
if (item.Checked)
{
delete = true;
lstvRecentProjects.Items.Remove(item);
foreach (string keyname in regKey.GetValueNames())
{
regKey.DeleteValue(keyname);
}
}
}
if (delete)
{
lstvRecentProjects.Refresh();
foreach (ListViewItem item in lstvRecentProjects.Items)
{
int key = item.Index + 1;
string keyname = name + key.ToString();
regKey.SetValue(keyname, item.SubItems[1].Text,
(RegistryValueKind)item.Tag);
}
}
}
catch (Exception ex)
{
MessageBox.Show("Exception: " + ex.Message +
"\r\nPlease report this Exception, " +
"mail to carlosaraiva@gmail.com!", "Exception",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
| You must Sign In to use this message board. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 25 Apr 2008 Editor: Deeksha Shenoy |
Copyright 2007 by Carlos Saraiva Jr. Everything else Copyright © CodeProject, 1999-2009 Web16 | Advertise on the Code Project |