Click here to Skip to main content
15,905,233 members
Home / Discussions / C#
   

C#

 
GeneralRe: IsNull with C# Pin
Ed.Poore22-Aug-06 6:09
Ed.Poore22-Aug-06 6:09 
AnswerRe: IsNull with C# Pin
Judah Gabriel Himango22-Aug-06 4:25
sponsorJudah Gabriel Himango22-Aug-06 4:25 
AnswerRe: IsNull with C# Pin
Ed.Poore22-Aug-06 4:26
Ed.Poore22-Aug-06 4:26 
Questionvalidation Pin
nachisaravanan22-Aug-06 2:57
nachisaravanan22-Aug-06 2:57 
AnswerRe: validation Pin
MCSD-Gandalf22-Aug-06 3:25
MCSD-Gandalf22-Aug-06 3:25 
Questionhow to keep a group together in a rdlc report? Pin
gus_br22-Aug-06 2:47
gus_br22-Aug-06 2:47 
AnswerRe: how to keep a group together in a rdlc report? Pin
Alex.Shnaider17-Apr-12 22:29
Alex.Shnaider17-Apr-12 22:29 
Questionhow do i get?... Pin
diddy3422-Aug-06 2:29
diddy3422-Aug-06 2:29 
AnswerRe: how do i get?... Pin
TikkuTakku22-Aug-06 2:41
TikkuTakku22-Aug-06 2:41 
Questionreportviewer not printing Pin
Glen Harvy22-Aug-06 2:15
Glen Harvy22-Aug-06 2:15 
QuestionPrinting messages from other classes in the main form. Pin
TikkuTakku22-Aug-06 2:04
TikkuTakku22-Aug-06 2:04 
AnswerRe: Printing messages from other classes in the main form. Pin
Christian Graus22-Aug-06 2:08
protectorChristian Graus22-Aug-06 2:08 
GeneralRe: Printing messages from other classes in the main form. [modified] Pin
TikkuTakku22-Aug-06 2:21
TikkuTakku22-Aug-06 2:21 
GeneralRe: Printing messages from other classes in the main form. Pin
engsrini22-Aug-06 6:56
engsrini22-Aug-06 6:56 
GeneralRe: Printing messages from other classes in the main form. Pin
Christian Graus22-Aug-06 11:03
protectorChristian Graus22-Aug-06 11:03 
Questionto read an element in DataGrid Pin
Pinnapureddy22-Aug-06 2:04
Pinnapureddy22-Aug-06 2:04 
AnswerRe: to read an element in DataGrid Pin
rah_sin22-Aug-06 2:13
professionalrah_sin22-Aug-06 2:13 
Questionhow to view in another... Pin
diddy3422-Aug-06 1:26
diddy3422-Aug-06 1:26 
AnswerRe: how to view in another... Pin
Martin#22-Aug-06 1:50
Martin#22-Aug-06 1:50 
AnswerRe: how to view in another... Pin
Christian Graus22-Aug-06 2:10
protectorChristian Graus22-Aug-06 2:10 
QuestionHow to know wheather a exe is running or not... Pin
Ravikumar Patra22-Aug-06 1:08
professionalRavikumar Patra22-Aug-06 1:08 
AnswerRe: How to know wheather a exe is running or not... Pin
Navi1522-Aug-06 1:27
Navi1522-Aug-06 1:27 
AnswerRe: How to know wheather a exe is running or not... Pin
gnjunge22-Aug-06 1:29
gnjunge22-Aug-06 1:29 
You can use a Mutex. Here is a piece of code that shows how to do it:


In program.cs:
<pre>
private static System.Threading.Mutex _mutex;
private const string _mutexName = "Company_Product_MUTEX";

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{

//Allow only one instance for this app to be active
try
{
//try to open existing mutex
_mutex = System.Threading.Mutex.OpenExisting(_mutexName);

if (_mutex != null)
return; //exit program;
}
catch
{ //There was no existing mutex so create mutex
try
{
_mutex = new System.Threading.Mutex(true, _mutexName);
}
catch { };
}

Application.ApplicationExit += new EventHandler(Application_ApplicationExit);

/// do rest of the code, like Application.Run() etc.

}

static void Application_ApplicationExit(object sender, EventArgs e)
{
//Release Mutex
if (_mutex != null)
{
_mutex.ReleaseMutex();
}
}

</pre>


That should do the trick.


AnswerRe: How to know wheather a exe is running or not... Pin
User 665822-Aug-06 1:29
User 665822-Aug-06 1:29 
AnswerRe: How to know wheather a exe is running or not... Pin
Eric Dahlvang22-Aug-06 6:14
Eric Dahlvang22-Aug-06 6:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.