This documentation is archived and is not being maintained.

Visual Basic Extensibility Reference

Visual Studio 6.0

AfterAddFile Event

See Also   Example   Applies To

Occurs after a component is added to the current Visual Basic project with the Add File command in the Project menu.

Syntax

Sub object_AfterAddFile(vbproject As VBProject, filetype As vbext_FileType, filename As String)

The AfterAddFile event syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
vbproject A VBProject object specifying the name of the project in which the file was added.
filetype An enumerated value (vbext_FileType) specifying the type of file that was added, as listed in Settings.
filename A string expression specifying the name of the file that was added.

Settings

The enumerated values for vbext_FileType are:

Constant Value Description
vbext_ft_Form 0 File type is a form.
vbext_ft_Module 1 File type is a basic module.
vbext_ft_Class 2 File type is a class module
vbext_ft_Project 3 File type is a project.
vbext_ft_Exe 4 File type is an executable file.
vbext_ft_Res 6 File type is a resource file.
vbext_ft_UserControl 7 File type is a User control.
vbext_ft_PropertyPage 8 File type is a Property Page.
vbext_ft_DocObject 9 File type is a User Document.
vbext_ft_Binary 10 File type is a binary file.
vbext_ft_GroupProject 11 File type is a group project.
vbext_ft_Designer 12 File type is a designer object.

Remarks

Visual Basic triggers this event only for files you can add from the Project menu. (That is, forms, classes, User controls, Property Pages, and modules). The AfterAddFile event does not occur if you select Add object from the Project menu. It also does not occur when an .Frx file is created for the first time, and doesn't occur twice when a form is added.

This event occurs in all add-ins that are connected to the FileControl object. The add-in cannot prevent the file from being written to disk because the operation is complete. However, you can use this event to perform other tasks, such as:

  • Log information about the event.

  • Update information about the file.

  • Backup the file.
Show: