Click here to Skip to main content
Licence CPOL
First Posted 25 May 2007
Views 26,820
Downloads 152
Bookmarked 29 times

Delete Links from the Recent Projects List on the Start Page of Visual Studio 2003, 2005 and 2008

By Carlos Saraiva Jr. | 25 Apr 2008
This application deletes links from the Recent Projects list on the Start page of Visual Studio 2003/2005/2008
2 votes, 9.1%
1
1 vote, 4.5%
2
1 vote, 4.5%
3
1 vote, 4.5%
4
17 votes, 77.3%
5
4.90/5 - 22 votes
3 removed
μ 4.59, σa 2.33 [?]
Screenshot - ssdrp.jpg

Introduction

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.

Background

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.

The Code

The PopulateListView Method

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);
                }
            }
        }

The DeleteRegKey Method

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);
            }
        }

History

  • 25th May, 2007: Initial post
  • 24th April, 2008: Article updated

License

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

About the Author

Carlos Saraiva Jr.

Software Developer

Brazil Brazil

Member
Carlos Saraiva Jr. is a Developer and works with C#, VB.NET, Javascript, ASP.NET, WPF, WCF, SQL Server 2005/2008, Oracle, in a Web, Windows Forms, Windows Services using Visual Studio 2005/2008.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 5 PinmemberYusuf12:32 18 Feb '11  
GeneralMy vote of 1 Pinmemberzhaoxili0:18 9 Nov '09  
Generalthank you! Pinmembergosiak5:43 15 Apr '09  
GeneralExcellent - Some Minor Tweaks PinmemberBobBoffin6:31 18 Mar '09  
GeneralExpress Editions PinmemberDaveyM697:14 30 Apr '08  
QuestionVS 2008 Pinmemberjackmos5:19 16 Dec '07  
GeneralRe: VS 2008 PinmemberCarlos Saraiva Jr.5:13 24 Apr '08  
GeneralThanks PinmemberErsin Ersoy9:47 17 Nov '07  
GeneralThanks Pinmemberranunes2:19 3 Oct '07  
GeneralThank You Pinmembermerlin9814:25 29 May '07  
GeneralThanks Pinmembersides_dale19:23 25 May '07  
AnswerRe: Thanks Pinmembersides_dale20:09 25 May '07  
AnswerRe: Thanks Pinmembersides_dale20:39 25 May '07  

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

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

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120206.1 | Last Updated 25 Apr 2008
Article Copyright 2007 by Carlos Saraiva Jr.
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid