472,986 Members | 2,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

???Process still running???

i delete a child folder wich works fine, but then after that i want to delete
the parent also and n ugly msgbox appears saying

An unhandled exception of type 'System.IO.IOException' occurred in
mscorlib.dll

Additional information: The process cannot access the file "c:\Documents and
Settings\Morne\FTPtest\fff" because it is being used by another process.
here is the code for the button and the del function

Function DelFolder(ByVal Path, ByVal FolderName)
' If Directory.Exists(Path & "\" & FolderName) Then
If Directory.Exists(Path) Then
Dim remDIR As DirectoryInfo
Dim parent As String

remDIR = Directory.GetParent(FolderName)
parent = remdir.FullName
ListBoxDIR.ClearSelected()
Directory.Delete(Path)
Application.DoEvents()
ListBoxDIR.Refresh()
ListBoxDIR.Path = parent
ListBoxFILE.Refresh()
Application.DoEvents()
ListBoxDIR = New Microsoft.VisualBasic.Compatibility.VB6.DirListBox
ListBoxFILE = New Microsoft.VisualBasic.Compatibility.VB6.FileListBo x
'ListBoxDIR.Path = remDIR
ListBoxDIR.Refresh()
ListBoxFILE.Refresh()
MsgBox("Directory deleted", MsgBoxStyle.Information)

ElseIf Directory.Exists(Path & "\" & FolderName) Then
Dim remDIR As String = ListBoxDIR.Path
Directory.Delete(Path & "\" & FolderName)
Application.DoEvents()
ListBoxDIR = New Microsoft.VisualBasic.Compatibility.VB6.DirListBox
ListBoxFILE = New Microsoft.VisualBasic.Compatibility.VB6.FileListBo x
'ListBoxDIR.Path = remDIR
ListBoxDIR.Refresh()
ListBoxFILE.Refresh()
MsgBox("Directory deleted", MsgBoxStyle.Information)
Else
MsgBox("This directory does not exists", MsgBoxStyle.Exclamation)
End If

End Function

Private Sub cmdLdelFOLDER_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdLdelFOLDER.Click

If ListBoxDIR.SelectedItem Is Nothing Then
MsgBox("You must first select a location", MsgBoxStyle.Exclamation)
Else
Dim Folder As String
Dim path As String
ListBoxDIR.Refresh()
path = ListBoxDIR.Path
Folder = ListBoxDIR.Path
DelFolder(path, Folder)
ListBoxDIR.Update()
ListBoxDIR.Refresh()
Application.DoEvents()
End If

End Sub
now by the look of it you might see that i tried a few things and yeah i
think there is i very easy way, BUT HOW, that is the question that i'm asking
you. Pleas help me i dont have any hair left and still need to program for
another 20 years or so.
Jul 21 '05 #1
0 1136

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

Similar topics

2
by: RL | last post by:
Hello Perl gurus, 1. I have a web page where I can push a button (dospawn.html). 2. This button calls a CGI script (spawnboss.cgi) 3. spawnboss.cgi calls a forking perl script (forkme.pl) 4....
3
by: Billg_sd | last post by:
Is there a programatic way in VB.NET to determine if a specific process is running? During an app update, I need to check if the component I'm about to replace is running. In UNIX I'd use: PS |...
77
by: Charles Law | last post by:
Hi guys I have a time critical process, running on a worker thread. By "time critical", I mean that certain parts of the process must be completed in a specific time frame. The time when the...
4
by: TieTo | last post by:
Hello, I'm looking for a way to identify a running process from which service it is started. All seems working well so far. I am using a simpel wmi call to enumerate all running processes and...
6
by: Moses M | last post by:
I posted this a short while ago , but I don't think I explained the problem clearly. Task Manager lists processes running on a local system, including a "user name" associated with each process...
2
by: Hayato Iriumi | last post by:
Hello, I have a need to kill a process. It sounds each enough, but the problem is that I have multiple executables running from different paths. Say, I have MyService.exe running from C:\FolderA...
0
by: WATYF | last post by:
This is my problem... I have some code that starts a Process and returns it to a variable... (prcBat) At any time while that process is running... I want to be able to Kill it by pressing a...
5
by: kd | last post by:
Hi All, If the name of a process is known, is it possible to check whether it is in execution? What I did was to fetch all the processes running on the system using Process.GetProcesses() and...
8
by: Henrik | last post by:
Hi Is there any way to see what the System process is doing? We have developed an application running at a production site to measure and optimize the production. The application needs to be...
3
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
I am using the following code to see if a process is currently running. I want to do something if it is NOT running. I am having trouble testing the array when no process is runing. Null won't...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.