vinonaweil
Revenue Diversification Expert
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
300 XP
This tutorial will teach you how to create a program that can delete all the files in the Recycle Bin and Empty it using the VB.NET language.
Now, let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
2. Next, add only one Button named Button1 and labeled it as "Empty Bin". You must design your interface like this:
3. Now, let's do the coding.
We will first declare functions named SHEmptyRecycleBin and SHUpdateRecycleBinIcon that will access the shell32 library together with its constants.
Now, we will create a sub procedure named EmptyRecycleBin that will delete all the files in it. It will also have the constants that we have declared above to be put it in the functions. This will be the main code for emptying the recycle bin.
Lastly, we will only put our sub procedure to the Button1 of its Clicking Event.
Try it and it will delete all files in the recycle bin!
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
Mobile: 09488225971
Landline: 826-9296
E-mail:[email protected]
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware
Download
Now, let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
2. Next, add only one Button named Button1 and labeled it as "Empty Bin". You must design your interface like this:

3. Now, let's do the coding.
We will first declare functions named SHEmptyRecycleBin and SHUpdateRecycleBinIcon that will access the shell32 library together with its constants.
- Private
Declare
Function
SHEmptyRecycleBin Lib
"shell32.dll"
Alias
"SHEmptyRecycleBinA"
(
ByVal
hWnd As
Int32, ByVal
pszRootPath As
String
, ByVal
dwFlags As
Int32)
As
Int32
- Private
Declare
Function
SHUpdateRecycleBinIcon Lib
"shell32.dll"
(
)
As
Int32
- Private
Const
SHERB_NOCONFIRMATION =
&
H1
- Private
Const
SHERB_NOPROGRESSUI =
&
H2
- Private
Const
SHERB_NOSOUND =
&
H4
Now, we will create a sub procedure named EmptyRecycleBin that will delete all the files in it. It will also have the constants that we have declared above to be put it in the functions. This will be the main code for emptying the recycle bin.
- Private
Sub
EmptyRecycleBin(
)
- SHEmptyRecycleBin(
Me
.
Handle
.
ToInt32
, vbNullString, SHERB_NOCONFIRMATION +
SHERB_NOSOUND)
- SHUpdateRecycleBinIcon(
)
- End
Sub
Lastly, we will only put our sub procedure to the Button1 of its Clicking Event.
- Private
Sub
Button1_Click(
ByVal
sender As
System.
Object
, ByVal
e As
System.
EventArgs
)
Handles
Button1.
Click
- EmptyRecycleBin(
)
- End
Sub
Try it and it will delete all files in the recycle bin!
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
Mobile: 09488225971
Landline: 826-9296
E-mail:[email protected]
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware
Download
You must upgrade your account or reply in the thread to view hidden text.