Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 352945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:47:04+00:00 2026-05-12T11:47:04+00:00

I’m attempting to supplement the help features for my code by providing other developers

  • 0

I’m attempting to supplement the help features for my code by providing other developers with code snippets. These produce skeletons of code which demonstrate how to use/call my classes or methods.

I’ve created a .snippet file and have placed it in the “%Visual Studio Folder%\Code Snippets\Visual Basic\My Snippets” folder. I’ve used the Code Snippets Manager and ensured that it included this folder so that I can access the snippets.

Everything works well when I have 1 CodeSnippet tag within the root CodeSnippets tag….

When I add more than one CodeSnippet tag to the file (each with their own title, and their own code example) I’m experiencing something strange.

The first CodeSnippet I’ve added contains code for adding something to my system, the second contains code for editing something in my system, and the third deleting something from the system.

When I use the code snippet by right clicking and selecting “Insert Code Snippet”, only the first code snippet in the file shows up as an option. When I select it, the code in the first CodeSnippet is inserted….but so is the code within the other CodeSnippet tags.

Do you have to have a separate XML .snippet file for each code snippet you want to make available?

After reading through MSDN about creating Code Snippets I was under the impression that this could all be done within one file.

It seems that I’m not understanding something very basic here and would love to find the answer but apparently Code Snippets are under used so finding the answer has proven to be a little trickier than I first thought it would be.

Thanks,

-Frinny

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:47:04+00:00Added an answer on May 12, 2026 at 11:47 am

    Do you have to have a separate XML .snippet file for each code snippet
    you want to make available? After
    reading through MSDN about creating
    Code Snippets I was under the
    impression that this could all be done
    within one file.

    I create and use snippets all the time. I wanted to do exactly what you intend. But, I have never gotten multiple snippets in one file to work. I also was under the impression you could do this. I even found an article, based on the beta version of Visual Studio, that demonstrated how to do this, but it didn’t work. Moreover, the documentation states:

    CodeSnippet Optional element. –
    Parent element for all code snippet
    data. There may be zero or more
    CodeSnippet elements in a CodeSnippets
    element.

    I eventually gave up and created separate files. I have not tried multiple snippets in one file with VS2k8 yet.

    Update

    I cannot get VB to support multiple snippets in one file using VS2k8. I used the following snippet as a test case. Snippet taken from http://msdn.microsoft.com/en-us/library/ms165394.aspx. Only the first CodeSnippet is read/loaded/used. I also counted all CodeSnippet elements in all snippet files (1143) and no file has more than one. Moreover, this snippet duplicates the behavior you noted in your question. Using the snippet inserts both message box statements.

    <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2008/CodeSnippet">
      <CodeSnippet Format="1.0.0">
        <Header>
          <Title>
            SECOND Snippet
          </Title>
        </Header>
        <Snippet>
          <Code Language="VB">
            <![CDATA[MsgBox("SECOND SNIPPET")]]>
          </Code>
        </Snippet>
      </CodeSnippet>
      <CodeSnippet Format="1.0.0">
        <Header>
          <Title>
            FIRST Snippet
          </Title>
        </Header>
        <Snippet>
          <Code Language="VB">
            <![CDATA[MsgBox("FIRST SNIPPET")]]>
          </Code>
        </Snippet>
      </CodeSnippet>
    </CodeSnippets>
    

    More Info

    I got to thinking that this has to be a bug that slipped through because Microsoft never put multiple snippets in the provided snippet files that come with Visual Studio, or VB.NET doesn’t support multiple snippets due to difficulties integrating with the enhanced statement completion capabilities of the editor.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 267k
  • Answers 267k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer One good place to start could be looking at how… May 13, 2026 at 12:51 pm
  • Editorial Team
    Editorial Team added an answer I asked Apple a similar question recently and got back:… May 13, 2026 at 12:51 pm
  • Editorial Team
    Editorial Team added an answer SELECT id, T.c.value('@v', 'NVARCHAR(MAX)') FROM @table CROSS APPLY datacolumn.nodes('/root/vnode') AS… May 13, 2026 at 12:51 pm

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want use html5's new tag to play a wav file (currently only supported
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I've got a string that has curly quotes in it. I'd like to replace
In order to apply a triggered animation to all ToolTip s in my app,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.