471,309 Members | 1,080 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,309 software developers and data experts.

strange problem....

Hi there,
I am using Visual Studio 2003 and trying to write an windows
application in C#. Whenever i run my program , it runs normally and i
close it. Sometime later, i try to run the program with Ctrl+F5 and i
get following errors
i)-Could cope temporary files to the output directory.
ii)-The file 'TestApp.exe' can't be copied to the run directory. The
process can't access the file because it is being used by another
process.
iii)-The file 'TestApp.pdb' can't be copied to the run directory. The
process can't access the file because it is being used by anopther
process.

Now open my Windows Task Manager, and goto the process and i find
'TestApp.exe' in the process and i close it from there and then try to
run my applicatoin and it runs. However next time i run my application
i get same errors and i goto Task Manager and goto the process and
delete it from there and then run the application. I have been moving
in this loop for all day along. Is there a way around? What i am doing
wrong?
Please enlighten me...
-Erland

Nov 28 '05 #1
3 943
Erland wrote:
Hi there,
I am using Visual Studio 2003 and trying to write an windows
application in C#. Whenever i run my program , it runs normally and i
close it. Sometime later, i try to run the program with Ctrl+F5 and i
get following errors

<snip>

Do you have threads in your application which isn't marked as background
threads?

--
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:la***@vkarlsen.no
PGP KeyID: 0x2A42A1C2
Nov 28 '05 #2
Nops im not using threads.
However, im creating a new form over a button in another form by using
following

this.Hide();
newform =new Form2();
newform.Show();
Thanks.

Nov 28 '05 #3
Erland wrote:
Nops im not using threads.
However, im creating a new form over a button in another form by using
following

this.Hide();
newform =new Form2();
newform.Show();
Thanks.


Ah, it's only when you close the "main form" that the program closes. If
you haven't found it by now, try adding an event handler on the Form2
that also closes the main form, something like this (before the .Show()
call):

newform.FormClosed += new FormClosedEventHandler(ChildFormClosed);

....

void ChildFormClosed(object sender, FormClosedEventArgs e)
{
Close();
}
--
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:la***@vkarlsen.no
PGP KeyID: 0x2A42A1C2
Nov 28 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Paul Drummond | last post: by
25 posts views Thread by Neil Ginsberg | last post: by
1 post views Thread by Sam Kong | last post: by
11 posts views Thread by Martin Joergensen | last post: by
8 posts views Thread by Dox33 | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.