Connecting Tech Pros Worldwide Forums | Help | Site Map

VB6 and C#

Member
 
Join Date: Mar 2008
Posts: 72
#1: Jul 3 '09
Expand|Select|Wrap|Line Numbers
  1. If App.PrevInstance = True Then
  2.         MsgBox "The Program is already running. ", vbInformation + vbOKOnly
  3.         Dim frm As Form
  4.         For Each frm In Forms
  5.         Unload frm
  6.         Set frm = Nothing
  7.         Next
  8.         End
  9. else
  10.  
  11. End Sub
i would like to know in c# what is represent the App.PrevInstance (vb6)

Expert
 
Join Date: Jun 2008
Location: Pretoria, South Africa
Posts: 410
#2: Jul 3 '09

re: VB6 and C#


Hi

You can use the Mutex class to achieve this.

A few things to remember when using a mutex:
The name you choose must be unique.
You must also release the mutex when exiting the application.

Feel free to post any code that is giving you problems.

Hope this helps.
Reply