In c#.net,

I had form 1,.. (contains Server and Database name)
in form 1 i had a button,..While clicking that button,.. the exe of form1 is called,..
so it will call twice,.. another instance is opened
while opening this instance,.. i can't do the debug,.. it directly executes (being an exe)

In this, i dont want to allow the form to be opened with the same server and database name,..
have to do some validation in code,...

How can i do this?
Plz help,... with ideas,.../

Recommended Answers

All 3 Replies

May I ask why you need to open a new executable?

Please describe the problem as I think your design could be somewhat improved.

To answer your original question, you will need to attach the debugger to the new process. This can be done in Tools(or by pressing Control + Alt + P)

In form1,
i am getting server and database name,.. while running the application i can able to debug the form 1

After running the application, by clicking the button in form 1, it calls the exe of form 1,
so that we can give new server and database name,...
through this code


string x = "sample.exe";
String filePath = Path.GetFullPath(x);
Process.Start(filePath);

so the exe of form1,.. directly executes,..
Here i want to check whether the user gives the same instance of server and database name,..
If so, i wont allow the user to enter the same server and database name,...

What I'm asking is, why are you launching another instance of your executable? What is your reasoning? I don't see any point to it from what you've said.

I also told you that you would have to attach the debugger to the new application, of course, without having a long Thread.Sleep at the beginning of your application, you're going to miss lines of execution before you manage to attach it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.