# Add Snippets to the Database

You can add your own code snippets to the database as follows:

1. Click the toolbar button or choose the Snippets | New Snippet menu option.
2. Provide information about the snippet, along with its source code in the resulting Add a Snippet dialogue box.

Existing user-defined snippets can be edited or deleted by selecting the required snippet and choosing the Edit Snippet and Delete Snippet options on the Snippets menu or using the or toolbar buttons.

Snippets can be categorised using any of the existing categories, or you can define your own using the Categories | New Category menu item. You can also rename your categories (Categories | Rename Category) and delete them when no longer needed (Categories | Delete Category). If you don't want to categorise them, just use the predefined User Defined Snippets category to keep them together.

If you want to create a new snippet that is similar to an existing snippet you can edit a copy of the existing snippet instead of starting from scratch. To do that first select the snippet you want to copy and duplicate it using the Snippets | Duplicate Snippet menu option (or press Shift+Ctrl+D) then edit the newly created snippet using the Snippets Editor as described above.

Changes to the user database are indicated by the display of a "Modified" flag in the status bar. The database can be saved using the Database | Save User Database menu option or the toolbar button. Note: the user database is automatically saved when CodeSnip is closed normally. The database can also be backed up and restored from the Database menu.

Snippets from the main database cannot be edited or deleted. The names of user defined snippets are displayed in a different colour to the snippets from the main database.