?
Solved

Deleting Files

Posted on 1998-10-06
1
Medium Priority
?
130 Views
Last Modified: 2010-04-30
i have a file list box and made it so when you double click a file it deletes it it work good but only when in a directory like c:\stuff but if i am on on c:\ it gives the error cant find file because this line (Dir1.Path & "\" & File1.List(i) ) makes  it say C:\\ how can i fix this problem this is the complete code i am using
If File1.ListIndex <> -1 Then
For i = 0 To File1.ListCount - 1
If File1.Selected(i) Then Kill Dir1.Path & "\" & File1.List(i)
ProgressBar1.Max = File1.ListCount - 1
ProgressBar1.Value = i
Next i
End If
ProgressBar1.Value = 0
File1.Refresh
 thanks
0
Comment
Question by:440
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
mark2150 earned 200 total points
ID: 1438519
You need to check to see if the rightmost char on the Dir1.Path is "\" and don't stick a 2nd one on if so.

work = Dir1.Path
if right( work, 1 ) <> "\" then work = work & "\"
work = work & File1.List(i)
If File1.Selected(i) Then Kill work


0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question