Absolutely right Chris. Singleton with lazy instantiation in other words ;)
Best regards,
Hammad.Rajjoub
http://dotnetwizards.blogspot.com
-Original Message-
From: Unmoderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Chris Day
Sent: Wednesday, March 02,
Create a member variable of the type of the form you are popping up, then
when you need to update it check if it is null, if so create and display it
otherwise just update the form that already exists.
Chris
-Original Message-
From: Adnan Siddiqi [mailto:[EMAIL PROTECTED]
Sent: Wednesday,
Hello
I am working on a C# application in which a listbox and comboboxes in form
are updated on the basis of dataGrid value passed in newly opened forum,I
can pass value in new open form by passing parameter in Form constructor but
everytime its opening new form,I want to keep a single instance of
Also another gotcha...especially note win2k
On MSDN (October 2001) this restiction is stated into the remarks
section:
Terminal Services: The name can have a "Global\" or "Local\" prefix to
explicitly create the object in the global or session name space. The
remainder of the name can contain an
Hi Neils:
As others have mentioned, you can preface the mutex with Global\.
You will see access denied errors if the second instance of the program runs
under a different user identity. By default, I believe only the creator and
SYSTEM have privileges to touch the mutex. It might take some PInvok
Hi David:
This is an easier approach, but it does have three weaknesses that might
cause problems, depending on the requirements.
1) Race conditions. Imagine two instances starting at nearly the same time,
seeing each other, and both shutting down.
2) I don't believe GetProcessByName will retrie
Hi
I have created a WS where one of the methods[1] takes a class[2] as an
argument. When a client is adding a web reference to this WS an error
message appears [3]
I do not understand this error message here, can anybody tell me what this
is about and what it meansand for future references wh
That did the trick. Thanks a lot.
--
Neils Christoffersen
-Original Message-
From: Unmoderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Steve Johnson
Sent: Tuesday, March 01, 2005 12:27 PM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DO
You could also just look to see if the process is already running. I would
think this would be lighter weight (don't need to keep a mutex around all
the time)
ex.
Process currProcess = Process.GetCurrentProcess();
Process [] runningProcesses =
Process.GetProcessesByName(currProcess.ProcessName);
You need to prefix the name with "Global\". See the CreateMutex()
documentation in the Win32 docs.
--
manaaki whenua | manaaki tangata | haere whakamua
http://hestia.typepad.com/flatlander | mailto:[EMAIL PROTECTED]
-Original Message-
From: Unmoderated discussion of advanced .NET topics
Neils Christoffersen wrote:
> Therefore, I need some sort of "system global" mutex, or another mechanism
> to achieve this.
> What's the best way?
Prefix your mutex name with "Global\". I haven't actually tried this
in .NET, but I'm sure it wraps the CreateMutex API, which, by default,
creates
Hello all,
I need to ensure that the program I've created has only one running instance
on a given machine. This is the solution that I decided on (pattern found at
http://www.ai.uga.edu/~mc/SingleInstance.html):
[STAThread]
public static void Main()
{
bool ok;
Mutex m = new Mutex
12 matches
Mail list logo