473,378 Members | 1,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Problem With Application.Exit()

Hi,

I have a problem with my application exit, I create a button that call
another form and close my application:

Private Sub closeApplication()
Dim Status As New Status
status.Show()

Application.Exit()
End Sub

At this new form I will rename the exe of the Main Form but when I
execute the:

System.IO.File.Copy(...)

But they give this error at the catch:

System.IO.IOException: The process cannot access the file "C:\......"
because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.File.InternalCopy(String sourceFileName, String
destFileName, Boolean overwrite)
at System.IO.File.Copy(String sourceFileName, String
destFileName, Boolean overwrite)
at Atualizar.Atualizar.trocarArquivos()

Anyone know how can I fix it? Another form to exit "full" to the
application for example ?

Thanx

Dec 21 '05 #1
3 1646
marciocamurati wrote:
Hi,

I have a problem with my application exit, I create a button that call
another form and close my application:

Private Sub closeApplication()
Dim Status As New Status
status.Show()

Application.Exit()
End Sub

At this new form I will rename the exe of the Main Form but when I
execute the:

System.IO.File.Copy(...)

But they give this error at the catch:

System.IO.IOException: The process cannot access the file "C:\......"
because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.File.InternalCopy(String sourceFileName, String
destFileName, Boolean overwrite)
at System.IO.File.Copy(String sourceFileName, String
destFileName, Boolean overwrite)
at Atualizar.Atualizar.trocarArquivos()

Anyone know how can I fix it? Another form to exit "full" to the
application for example ?

Thanx


This will not do what you want. Application.exit will cease all
processing in all forms. So your exe will stay locked until your
program exits which means you can not do your copy. The way to do what
you want is to start a new process, close the exe your want to copy and
have the new process process do the copying. Which means you basically
need a seperate program to do your copying.

Chris
Dec 21 '05 #2
Hi again,

I found it at the Google search:

http://www.experts-exchange.com/Prog..._21640044.html

And it resolve my problem killing the process of the application if it
alive.
Thanks;.

Dec 21 '05 #3
Hi,

And how can I close that exe ? I execute anther exe that will make the
copy, in this new exe I will send a command to close the other, how can
I do this ?

Thanx

Dec 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Guinness Mann | last post by:
Pardon me if this is not the optimum newsgroup for this post, but it's the only .NET newsgroup I read and I'm certain someone here can help me. I have a C# program that checks for an error...
4
by: Chuck | last post by:
Hello everybody, I need to abort execution during start up, while the constructor called by Application.Run is executing. If the database fails to connect during my application's startup I...
15
by: Mike Fellows | last post by:
im running the code below when a new item is selected within a combobox the code runs fine but when it gets to me.close it crashes - it doesnt start the next form just crashes (its not debugabble)...
0
by: Stewart Midwinter | last post by:
I have a Tkinter app running on cygwin. It includes a Test menu item that does nothing more than fetch a directory listing and display it in a Toplevel window (I'd use a tkMessageBox showinfo...
0
by: Ben | last post by:
I modified the logmonitor sdk example so it would work over a network. It works great when the client and server are running on the same PC and have administrator privileges. So I have two...
5
by: Patrick F | last post by:
I have a problem closing down the application, i haven't dont much in the project yet, so it contains a program.cs file (generated by Visual studio) with the main function. Also my main form, now...
5
by: =?Utf-8?B?Z215ZXJz?= | last post by:
Hello, I am attempting to start a cmd.exe process and pass several .vbs scripts (with additional parameters) and then read the output from the scripts and make "notes" in a DataTable (the...
1
by: quill | last post by:
Hi I am making a chatroom script and it appears that the problem seems to be that my setTimeout's are conflicting. The logic is as follows: Run a login check every x seconds Run a trigger...
3
by: Rene | last post by:
Hello to all! For a long time I have been "fighting" a problem compiling an OpenGL program which uses GLUT. First I have put a question in a Watcom group (I want to use this compiler) to which I...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.