473,396 Members | 1,666 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,396 software developers and data experts.

Putting into Recycle Bin in VB 2005?

I searched and found a way (via API) t0 add a deleted file to the
recycle bin. (Thanks Ken Tucker! :))

But I was wondering if VB.NET 2005 (framework 2.0) has a non-api
solution.

(Note: i think it's crazy that you have to manually add code to add a
file to the recycle bin. You'd think the opposite would be true. i.e.
deleting a file and skipping the recycle bin would need special code.)

Thanks!
John

Jan 3 '06 #1
5 1623
January 3, 2005

Never thought about that! Good idea!

What I would expect for something like that (if it is not already there) is:

Public Class File -- From IO

Shared Sub Delete(byval FilePath as string) - Also sends to recycle bin

Shared Overloads Sub Delete(byval FilePath as string, byval SendToRecycleBin
as boolean) - Doesn't send if 2nd para = False
--

Joseph Bittman
Microsoft Certified Solution Developer
Microsoft Most Valuable Professional -- DPM

Blog/Web Site: http://71.39.42.23/

"johnb41" <js********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
I searched and found a way (via API) t0 add a deleted file to the
recycle bin. (Thanks Ken Tucker! :))

But I was wondering if VB.NET 2005 (framework 2.0) has a non-api
solution.

(Note: i think it's crazy that you have to manually add code to add a
file to the recycle bin. You'd think the opposite would be true. i.e.
deleting a file and skipping the recycle bin would need special code.)

Thanks!
John

Jan 3 '06 #2
Check out this method...

My.Computer.FileSystem.DeleteFile

Is has a parameter for optional sending to the Recycle Bin.

Like Joseph, I would have expected this to be in the IO namespace
(specifically System.IO.File.Delete) for for some unfathamable reason, MS
chose to hide this in the My namespace. I can see where MS would want to
aggregate a bunch of commonly-used method from across the entire Framework
into a nice, easy-to-access namespace. So, I personally agree with the
whole My thing. But what I don't get is why they would add functionality
*only* to the My namespace. Fair enough if you want to make it easier on
the people who don't know the Framework, but don't do it in such a way that
it actually makes it harder for people who *do* know the Framework.
OK. I feel better now. :-)

- Mitchell S. Honnert
"johnb41" <js********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
I searched and found a way (via API) t0 add a deleted file to the
recycle bin. (Thanks Ken Tucker! :))

But I was wondering if VB.NET 2005 (framework 2.0) has a non-api
solution.

(Note: i think it's crazy that you have to manually add code to add a
file to the recycle bin. You'd think the opposite would be true. i.e.
deleting a file and skipping the recycle bin would need special code.)

Thanks!
John

Jan 3 '06 #3
Thanks Joseph and Mitchell! Yes, it doesn't make sense that the My
namespace supports it but IO doesn't. It's an obvious feature that
should have been in IO from day one. Well, at least it's supported in
some fashion. Thanks for the tip!

John

Jan 4 '06 #4
guy
hmm thats interesting!
I wonder how MS have implemented it in the My namespace, presumably they
must use an api call if its not in the framework ...

guy

"Mitchell S. Honnert" wrote:
Check out this method...

My.Computer.FileSystem.DeleteFile

Is has a parameter for optional sending to the Recycle Bin.

Like Joseph, I would have expected this to be in the IO namespace
(specifically System.IO.File.Delete) for for some unfathamable reason, MS
chose to hide this in the My namespace. I can see where MS would want to
aggregate a bunch of commonly-used method from across the entire Framework
into a nice, easy-to-access namespace. So, I personally agree with the
whole My thing. But what I don't get is why they would add functionality
*only* to the My namespace. Fair enough if you want to make it easier on
the people who don't know the Framework, but don't do it in such a way that
it actually makes it harder for people who *do* know the Framework.
OK. I feel better now. :-)

- Mitchell S. Honnert
"johnb41" <js********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
I searched and found a way (via API) t0 add a deleted file to the
recycle bin. (Thanks Ken Tucker! :))

But I was wondering if VB.NET 2005 (framework 2.0) has a non-api
solution.

(Note: i think it's crazy that you have to manually add code to add a
file to the recycle bin. You'd think the opposite would be true. i.e.
deleting a file and skipping the recycle bin would need special code.)

Thanks!
John


Jan 4 '06 #5
> I wonder how MS have implemented it in the My namespace, presumably they
must use an api call if its not in the framework ... It's in the Framework; it's just not in the right *place* in the Framework.
Or to be more precise, it's not in the place someone who is experienced with
previous versions of the Framework would expect it to be.

- Mitchell S. Honnert
"guy" <gu*@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com... hmm thats interesting!
I wonder how MS have implemented it in the My namespace, presumably they
must use an api call if its not in the framework ...

guy

"Mitchell S. Honnert" wrote:
Check out this method...

My.Computer.FileSystem.DeleteFile

Is has a parameter for optional sending to the Recycle Bin.

Like Joseph, I would have expected this to be in the IO namespace
(specifically System.IO.File.Delete) for for some unfathamable reason, MS
chose to hide this in the My namespace. I can see where MS would want to
aggregate a bunch of commonly-used method from across the entire
Framework
into a nice, easy-to-access namespace. So, I personally agree with the
whole My thing. But what I don't get is why they would add functionality
*only* to the My namespace. Fair enough if you want to make it easier on
the people who don't know the Framework, but don't do it in such a way
that
it actually makes it harder for people who *do* know the Framework.
OK. I feel better now. :-)

- Mitchell S. Honnert
"johnb41" <js********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
>I searched and found a way (via API) t0 add a deleted file to the
> recycle bin. (Thanks Ken Tucker! :))
>
> But I was wondering if VB.NET 2005 (framework 2.0) has a non-api
> solution.
>
> (Note: i think it's crazy that you have to manually add code to add a
> file to the recycle bin. You'd think the opposite would be true. i.e.
> deleting a file and skipping the recycle bin would need special code.)
>
> Thanks!
> John
>


Jan 4 '06 #6

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

Similar topics

1
by: Frank Meng | last post by:
Hi. I wrote a program to get the directory of "Recycle Bin" with SHGetSpecialFolderLocation . It works for "Recent", "SendTo", etc. but it doesn't work for "Recycle Bin". At...
0
by: raghav | last post by:
Hi Friends I have a question. I work throughtout the day with my application (C#.NET, ASP.NET 2.0, SQL SERVER 2005 ). By end of the day if I see my Recycle Bin full of app_offline files. Then...
4
by: rob | last post by:
Does C# 2005 have an easy way to delete files to the recycle bin?
2
by: =?Utf-8?B?VVNBT3o=?= | last post by:
I am using Windows Vista Ultimate (x86). I accidently deleted my Desktop Recycle Bin. I restored it (Control Panel/Personalise/Change Desktop Icons). I clicked on the Recycle Bin (Full) icon...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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,...

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.