Aracılığıyla paylaş


How to: Specify Instancing Behavior for an Application (Visual Basic)

Note

This topic applies only to Visual Basic projects.

Windows-based applications created with Visual Basic are multiple-instance applications by default; users can open multiple instances of the compiled application. In some cases, you may want to prevent users from opening multiple instances of a Windows-based application. You can do this by setting the Make Single Instance Application property for your project, which you can set from the Application page of the Project Designer.

When the Make single instance application check box is selected, only a single instance of the compiled application is allowed. If a user tries to open a second instance, focus is shifted to the instance that is already running, and its StartupNextInstance event is raised.

The Make single instance application check box is available only if the Enable application framework check box is selected.

To create a single- or multiple- instance application

  1. With a project selected in Solution Explorer, on the Project menu, click Properties.

  2. Click the Application tab.

  3. Under Windows application framework properties, select or clear the Make single instance application check box.

    Note

    Applications are multiple instances by default.

See Also

Reference

Application Page, Project Designer (Visual Basic)

My.Application.StartupNextInstance Event

Other Resources

Managing Application Properties

Change History

Date

History

Reason

September 2009

Added information about the Windows application framework.

Customer feedback.