473,857 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem With Application.Exi t()

Hi,

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

Private Sub closeApplicatio n()
Dim Status As New Status
status.Show()

Application.Exi t()
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.IOExc eption: The process cannot access the file "C:\......"
because it is being used by another process.
at System.IO.__Err or.WinIOError(I nt32 errorCode, String str)
at System.IO.File. InternalCopy(St ring sourceFileName, String
destFileName, Boolean overwrite)
at System.IO.File. Copy(String sourceFileName, String
destFileName, Boolean overwrite)
at Atualizar.Atual izar.trocarArqu ivos()

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

Thanx

Dec 21 '05 #1
3 1689
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 closeApplicatio n()
Dim Status As New Status
status.Show()

Application.Exi t()
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.IOExc eption: The process cannot access the file "C:\......"
because it is being used by another process.
at System.IO.__Err or.WinIOError(I nt32 errorCode, String str)
at System.IO.File. InternalCopy(St ring sourceFileName, String
destFileName, Boolean overwrite)
at System.IO.File. Copy(String sourceFileName, String
destFileName, Boolean overwrite)
at Atualizar.Atual izar.trocarArqu ivos()

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.exi t 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
8529
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 condition and if it finds it it notifies the user with a MessageBox and then on the next line of code (example in a minute) it calls Application.Exit(). To my astonishment, I stepped through the code with the debugger, and watched it call...
4
11174
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 want to display a message (no problem here) and then abort the program. However, after the attached code executes I end up with my main form and a wait cursor! If I click on the X the form closes. Boss doesn't think an unhandled exception will...
15
1379
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) it seems to be a problem with the .net framwork - have i done something silly, or have i found a known bug - if so is there a workaround? Thanks in advance for your help Mike Fellows
0
2368
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 widget, but for some reason the text is invisible on cygwin). After I close the Toplevel widget, all of the menus in my app behave as though they have no contents to them, i..e I can press on the File menu button, and see it depress, but the Exit...
0
1312
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 problems: 1) I cannot run the client without administrator privileges. If I try I get the following message: Unhandled Exception: System.Security.SecurityException: Requested registry access is not allowed. at...
5
2611
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 my problem is that, in afew places in my mainForm i want to Exit the application and close the probram, when i try: Application.Exit(); nothing happens, it keeps running. Then i also tried to add private void mainForm_FormClosed(object sender,...
5
3460
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 "notes" not being the issue). Beginning with... Dim objProcess As Process Dim objProcessStartInfo As New ProcessStartInfo
1
2927
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 check every x seconds
3
3449
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 got no reply, in an OpenGL group somebody recommended me to use Visual C++ which I did. That worked OK but I do would like to use Watcom. In the meantime I found solutions to several of the errors I got but one is left which I cannot find a...
0
10711
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10808
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10394
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9549
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5774
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5971
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4592
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4191
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.