Sharing Files in Visual SourceSafe
In this exercise you will share a Visual Basic form with multiple projects.
Note Before doing this exercise, you must complete the Using Visual SourceSafe exercise that appears earlier in this chapter.
* To Create a new Visual SourceSafe Project
- In the Visual SourceSafe Explorer, select the root project "$/" in the All projects treeview.
- From the toolbar, click Create Project .
- In the Project box of the Create Project dialog, type Shared Objects and then click OK .
- In the All projects treeview, select Shared Objects .
- From the toolbar, click Create Project .
- In the Project box of the Create Project dialog type Login .
- In the All projects treeview, select Login .
- From the toolbar, click Add Files .
- Browse for the folder WA\Practice\Ch13\Shared\Login .
- Select all the files in the file list and then click Add .
- Leave the comment blank and click OK .
- Click Yes to set WA\Practice\Ch13\Shared\Login as your personal working folder.
- Click Close to return to the Visual SourceSafe Explorer.
* To share the Login form with other Visual SourceSafe projects
- In the All projects treeview, select Hubble .
- From the toolbar, click Share .
This opens the Share with $/Hubble dialog.
- In the Projects list, double-click Shared Projects and then click Login .
- In the File to share list, select frmLogin.frm then click Share .
- Click Close to return to the Visual SourceSafe Explorer.
Notice frmLogin.frm has been added to the Contents list of the Hubble project. This icon is different from the rest to indicate that this file is shared with another Visual SourceSafe projects. The frmLogin.frm file is also copied to the working directory of the Hubble project.
- Repeat steps 1 to 5 to share frmLogin with the NASA project.
* To add the Login form to the Hubble and NASA projects - From Visual Basic, open the Hubble project.
- Click Add Form on the Project menu.
- Click the Existing tab and select frmLogin.frm , then click Open .
If you get a message saying "Project file is read-only," close the message box and Check Out the project from Visual SourceSafe. Now you will be able to add the Login form to the project. Since the Hubble.vbp file stores information about which files are included in your project, Visual Basic will not let you add any files to the project unless the project file (.vbp) file is checked out. Repeat Step 3 if necessary.
- Click OK to the message indicating that Visual Basic failed to add this form to the Visual SourceSafe project.
This message appears because the file has already been added to Visual SourceSafe.
- In the Project Explorer, right-click frmLogin and click Check Out .
- Repeat Step 5 to check frmLogin back into Visual SourceSafe.
When you check the file out and then back in, Visual Basic updates the icon used in the Project Explorer. Notice how it differs from the other icons in the Project explorer. This is because this form is shared with other projects.
- Save your project.
- Repeat steps 1 to 7 for the NASA project.
* To check shared files out and in of Visual SourceSafe
- With the NASA project open, from the Project Explorer, right-click frmLogin.frm and select Check Out .
- Switch to the Visual SourceSafe Explorer and notice that the file is checked out of all three projects we have added. If the Visual SourceSafe Explorer does not have the files marked as checked out, click Refresh File List from the View menu.
- Switch to Visual Basic and check in the frmLogin.frm form.