Visual Source Safe

I am looking for detailed explanation / code Example on
how to do the following in VB , using VSS references:

1) Check out a file
2) Check in a file + Comments.
3) Get version X of file Y.

The VSS server is not sitting in the machine where
the vb app is running, but on server ZZZZ.


Who is Participating?
anthony_glenwrightConnect With a Mentor Commented:
The article is here:

Good luck!

Note:  A tip - when you first use ...
Private WithEvents SourceSafeInstance As SourceSafeTypeLib.VSSApp

... to sink events, you will have problems in VB(6) because they used a VB reserved word in all the event templates...

Pretty silly, huh (-:   You can fix it by doing a search/replace, replacing all instance of "Local" with "strLocal" (I think thats the one - it was a while ago...)
First, VSS is intended as a client-server app in your scenario.  You need to install the client version of VSS on the client.

Once you've done that, start VB with the desired project.

You will probably be asked if you'd like to check it into source safe.  If so, you'll need to do administation to set up the project.

1) Check out a file
  Simply right-click on the desired form/class/module in the VB Project window and near the bottom you'll see "Check Out"

2) Check in a file + Comments.
  When done modifying, right-click as above and select "Check In..."  In the next window, enter comments then click OK.

3) Get version X of file Y.
  Go to Source Safe and locate the version you want and select each file, then right-click and select View, then "check out this..."
Open Visual Sourcesafe admin
First you have to create a database.
Goto Tools - Create Database
Choose the directory name or enter a new name

Then you have to create a user account in VSS.
Users - Adduser option

You have the options to set user rights etc in Tools menu itself.
Next Open  Microsoft Visual SourceSafe
Browse the directory where you have created the database
Type in user name and password

Visual Sourcesafe Explorer window will open with $ directory open.
Goto File- create project and create a project
Add the files required (your frm,vbp,frx files) by File- Add files option

Once you use add files to the sourcesafe it will get added to vss database. But you require  a directory to checkout files. You can set it by File - set working folder option.
When ever you checkout a file source safe will overwrite the local copy in this directory from the VSS database.

You can checkout files using vss or vb.
Tools - sourcesafe - Checkout
Select the forms or modules or files required

You can checkout the entire project from VSS by rightclicking on the project name and choosing check out option.

To get a specific version using Vb
Tools - sourcesafe - Show history
Click on Ok without entering form  or to
Now it will display all the versions
Choose the version and click Get button

When ever you make a change in a file and check in, it will update the VSS, and creates a new version.


Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

I think he wants to know how to do it in code...

Theres an excellent article on how to do Sourcesafe automation on the MSDN web site, and there is a sample project for VB (the whole SourceSafe explorer, written in VB).  Go to
yes Anthony. Now I think so. Any way he hasn't responded. Lets see
eofekAuthor Commented:
Sorry for the late response.
Anthony is very correct.
a sample project of a VSS written in VB is exactly what I need ( even better).
But I couldn't find it inthe link you gave.
Could you please give the full link to the download page of this specific sample ?
I tried looking for it but couldn't find it.


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.