Vb.net Question

"make single instance application" what does this do?

in vb 2008 express this option is available under application properties. does anyone know what is its function? does it make it so that it's impossible to open two instances at the same time?

Answer Source

There is even a easier method:

Use the following code...

Imports System.IO

On the main form load event do the following:

If File.Exist(Application.StartupPath & "\abc.txt") Then
'You can change the extension of the file to what ever you desire ex: dll, xyz etc.
msgbox("Only one Instance of the application is allowed!!!")
File.Create(Application.StartupPath & "\abc.txt", 10, Fileoptions.DeleteonClose)

This will take care of single instances as well as thin clients, and the file cannot be deleted while the application is running. and on closing the application or if the application crashes the file will delete itself.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download