Johny Bravo
asked on
Multi session in .net
I am developing a windows application in VS 2008.
In my MDIForm I have two tabs as multi-session and switch.
After logging-in,user will be able to see the MDIForm,if he clicks the Multi-session tab and then click 'Switch',it needs to open a new instance of the application.
I mean two forms running at same time.And it shud be two instances only.Means maximum two forms can be viewed at a time.
How can I do this?
In my MDIForm I have two tabs as multi-session and switch.
After logging-in,user will be able to see the MDIForm,if he clicks the Multi-session tab and then click 'Switch',it needs to open a new instance of the application.
I mean two forms running at same time.And it shud be two instances only.Means maximum two forms can be viewed at a time.
How can I do this?
you can use the mdiform.MDIChildren collection to check if the form already exists.
ASKER
hi thanks for ur comment,
i will give it a try n let u know.I need 2 days for it.
i will give it a try n let u know.I need 2 days for it.
ASKER
Hi CodeCruiser,
Can u pls tell me how to do this?
Can u pls tell me how to do this?
ASKER
I want two instances of the Application.
It means two MDIForms will be running.
It means two MDIForms will be running.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am getting error
proclist ia a variable but it is used as a method
I have converted it to c#
Process[] procList = Process.GetProcesses();
int i = 0;
int AppCount = 0;
for (i = 0; i <= 20 - 1; i += i + 1)
{
if (procList(i).ProcessName == "applicationname")
{
AppCount += 1;
}
}
if (AppCount < 2)
{
}
else
{
//Start New Instance
}
//Already two instances running
proclist ia a variable but it is used as a method
I have converted it to c#
Process[] procList = Process.GetProcesses();
int i = 0;
int AppCount = 0;
for (i = 0; i <= 20 - 1; i += i + 1)
{
if (procList(i).ProcessName == "applicationname")
{
AppCount += 1;
}
}
if (AppCount < 2)
{
}
else
{
//Start New Instance
}
//Already two instances running
ASKER
ohh ok it's my mistake
it should be square brackets.
procList[i].ProcessName
it should be square brackets.
procList[i].ProcessName
ASKER
Need your assistance
I am writing above code in Switch click event.
Following are my questions:
1>Why the loop we iterate 19 times.
2>What code should go under MultiSession click
3>What is 'applicationname",is it the solution's name?
I am writing above code in Switch click event.
Following are my questions:
1>Why the loop we iterate 19 times.
2>What code should go under MultiSession click
3>What is 'applicationname",is it the solution's name?
Hi,
1) Its an oversight on my part. It should run to processlist.count - 1. Also change your loop from i += i + 1 to i++
2) All this code should go under multisession click.
3) You need to experiment with this one. I think it would be the exe name but not sure. Use a messagebox to get the name.
1) Its an oversight on my part. It should run to processlist.count - 1. Also change your loop from i += i + 1 to i++
2) All this code should go under multisession click.
3) You need to experiment with this one. I think it would be the exe name but not sure. Use a messagebox to get the name.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks CodeCruiser!!!
It works fine.
Thanks again
It works fine.
Thanks again
ASKER
Can you pls tell me how can I switch between the forms?
Glad to be helpful. To switch between the forms, you could use the Form.Activate method.
ASKER
Ok thanks