The “A” in BASIC—the predecessor of Visual Basic—stands for “all-purpose.” As an heir of that original programming language, Visual Basic has maintained the standard of being an all-purpose language, a language that is generic enough to handle a vast set of different programming needs. That has never been truer than with Visual Basic 2005.
The recipes included in this chapter cover a wide range of topics, from basic application management to credit card verification. The key is that you can do all these varied tasks quite easily in Visual Basic.
You don’t want the active user to run more than one copy of an application at any one time.
Sample code folder: Chapter 14\SingleInstanceOnly
Capture attempts to start up secondary instances of an application through an application-wide event handler. This event handler, new to Visual Basic 2005 and available only to Windows Forms applications using the Application Framework, triggers in the primary instance whenever the user tries to start a secondary instance.
Create a new Windows Forms application in Visual Studio. The Application Framework is enabled by default; you can confirm this by checking the “Enable application framework” field on the Application tab of the Project Properties window, shown in Figure 14-1.
Even with the Application ...