473,385 Members | 1,342 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,385 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 1151

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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.