Running an application twice

Hi,
I would like to know how I can prevent the user from running the EXE file twice.
cause when I do run an EXE twice, I get an error telling me
 "address in use".
kukiyaAsked:
Who is Participating?
 
kfyipConnect With a Mentor Commented:
You can use "App.PrevInstance" to check whether an instance of the same application is running.
0
 
rovermCommented:
use this in your form_load event:

If App.PrevInstance Then
    MsgBox "Already started !!", vbCritical + vbOKOnly, "SOM"
    Unload Me
    End
End If

D'Mzzl!
RoverM
0
 
rovermCommented:
whoops, you can leave out "SOM" (the title of the msgbox).
kfyip: sorry, had the question open while building the example, didn't see you answer before I posted mine ;-) !

D'Mzzl
RoverM
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
kukiyaAuthor Commented:
Adjusted points to 10
0
 
kukiyaAuthor Commented:
It worked well when I add the "Unload"
thank you very very much!!!!!!
0
 
rovermCommented:
I know, using it also !
did you see that your q is in the 'waiting to be graded' section twice ?
I wonder if you have graded this one, the other will dissapear too !?

D'Mzzl!
RoverM
0
 
kukiyaAuthor Commented:
what do you mean by 'waiting to be graded' section twice '?
0
 
rovermCommented:
Take a look at the section PAQ, your question is appearing twice!
My question: why did you give kfyip the points while you wrote that 'It worked well when I add the "Unload" ', MY CODE!
<TEARS> ;-)

D'Mzzl!
RoverM
0
 
kukiyaAuthor Commented:
I'm sorry, I not very familier with the points buisness.
of course you should get points.
please tell me how I can reward you now.

now smile!!!!!!
0
 
rovermCommented:
No need to ! Just kidding! But to 'teach' you:

You can accept any comment as an answer by clicking the command button next to the comment-header.

D'Mzzl!
RoverM <LOL>
0
 
kukiyaAuthor Commented:
ok thank you very much!!!!!!
I'll use this from now on.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.