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

Deleting All Selected Checked files

Thank you in advance for any and all assistance. I have an application that
pulls files, folders and registry keys of installed programs. I'm wanting to
with a context menu selection of "Delete Selected", delete "ALL" of the
checked selected files, folders, registry keys. Can someone show me some code
to do this please?
Jun 28 '06 #1
7 1813

eSolTec wrote:
Thank you in advance for any and all assistance. I have an application that
pulls files, folders and registry keys of installed programs. I'm wanting to
with a context menu selection of "Delete Selected", delete "ALL" of the
checked selected files, folders, registry keys. Can someone show me some code
to do this please?


I don't have the time to enter a bunch of code, but basically you can
use the File.Delete method to delete files, Directory.Delete method to
delete folders, and the RegistryKey.DeleteValue,
RegistryKey.DeleteSubKey or RegistryKey.DeleteSubKeyTree (depending on
your needs) to delete registry entries.

Help has samples for all.

Jun 28 '06 #2
Zack,

thank you for your reply, but I'm using a treeview with an array in it and
the RegistryKey.Delete from MyComputer didn't work. So I would appreciate
someone either taking the time to show me some code for deleting files,
folders and registry keys. Thank you again for any and all assistance.

"za***@construction-imaging.com" wrote:

eSolTec wrote:
Thank you in advance for any and all assistance. I have an application that
pulls files, folders and registry keys of installed programs. I'm wanting to
with a context menu selection of "Delete Selected", delete "ALL" of the
checked selected files, folders, registry keys. Can someone show me some code
to do this please?


I don't have the time to enter a bunch of code, but basically you can
use the File.Delete method to delete files, Directory.Delete method to
delete folders, and the RegistryKey.DeleteValue,
RegistryKey.DeleteSubKey or RegistryKey.DeleteSubKeyTree (depending on
your needs) to delete registry entries.

Help has samples for all.

Jun 28 '06 #3
Zacks,

I have a Treeview (array list) of items that are registry keys, file names,
folder names that I wish to programmatically delete from their locations. Any
help for code would be greatly appreicated. Most are Registry Keys that I
wish to programmatically delete. I have looked at System.IO and also the
RegistryKey.Delete in the MyComputer Class and nothing so far has worked.

"za***@construction-imaging.com" wrote:

eSolTec wrote:
Thank you in advance for any and all assistance. I have an application that
pulls files, folders and registry keys of installed programs. I'm wanting to
with a context menu selection of "Delete Selected", delete "ALL" of the
checked selected files, folders, registry keys. Can someone show me some code
to do this please?


I don't have the time to enter a bunch of code, but basically you can
use the File.Delete method to delete files, Directory.Delete method to
delete folders, and the RegistryKey.DeleteValue,
RegistryKey.DeleteSubKey or RegistryKey.DeleteSubKeyTree (depending on
your needs) to delete registry entries.

Help has samples for all.

Jun 28 '06 #4
Try something like :
My.Computer.Registry.CurrentUser.DeleteSubKeyTree( "Software\MyCompany")

My.Computer.FileSystem.DeleteDirectory("c:\MyDirec tory",
FileIO.DeleteDirectoryOption.DeleteAllContents)

Generally it's always better that YOU show us what you do. For example my
first thought would be that you try to delete something you are not allowed
to delete (in which case our code wouldn't work better, also we could
provide VB2005 code when you are using VB 2003).

Also please always include an accurate description of the result you have
instead of just saying it didn't work...

--
Patrice

"eSolTec, Inc. 501(c)(3)" <eS*************@discussions.microsoft.com> a
écrit dans le message de news:
66**********************************@microsoft.com...
Zack,

thank you for your reply, but I'm using a treeview with an array in it and
the RegistryKey.Delete from MyComputer didn't work. So I would appreciate
someone either taking the time to show me some code for deleting files,
folders and registry keys. Thank you again for any and all assistance.

"za***@construction-imaging.com" wrote:

eSolTec wrote:
> Thank you in advance for any and all assistance. I have an application
> that
> pulls files, folders and registry keys of installed programs. I'm
> wanting to
> with a context menu selection of "Delete Selected", delete "ALL" of the
> checked selected files, folders, registry keys. Can someone show me
> some code
> to do this please?


I don't have the time to enter a bunch of code, but basically you can
use the File.Delete method to delete files, Directory.Delete method to
delete folders, and the RegistryKey.DeleteValue,
RegistryKey.DeleteSubKey or RegistryKey.DeleteSubKeyTree (depending on
your needs) to delete registry entries.

Help has samples for all.

Jun 28 '06 #5
Patrice,

Thank you for your tips. I greatly appreciate it.

VB 2005
Treeview: tv_Results
Code:
If MessageBox.Show("Delete all selected registry keys?",
"Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.Yes Then
Dim FileList As ArrayList
My.Computer.Registry.CurrentUser.DeleteSubKey(File List.ToString)

End If

Most of the keys are from programs that would be considered rogue or stuborn
to find an uninstaller or to uninstall from a computer. I'm building a tech
tool for my non-profit organization. Using messagebox to confirm the delete
first as you can see.

"Patrice" wrote:
Try something like :
My.Computer.Registry.CurrentUser.DeleteSubKeyTree( "Software\MyCompany")

My.Computer.FileSystem.DeleteDirectory("c:\MyDirec tory",
FileIO.DeleteDirectoryOption.DeleteAllContents)

Generally it's always better that YOU show us what you do. For example my
first thought would be that you try to delete something you are not allowed
to delete (in which case our code wouldn't work better, also we could
provide VB2005 code when you are using VB 2003).

Also please always include an accurate description of the result you have
instead of just saying it didn't work...

--
Patrice

"eSolTec, Inc. 501(c)(3)" <eS*************@discussions.microsoft.com> a
écrit dans le message de news:
66**********************************@microsoft.com...
Zack,

thank you for your reply, but I'm using a treeview with an array in it and
the RegistryKey.Delete from MyComputer didn't work. So I would appreciate
someone either taking the time to show me some code for deleting files,
folders and registry keys. Thank you again for any and all assistance.

"za***@construction-imaging.com" wrote:

eSolTec wrote:
> Thank you in advance for any and all assistance. I have an application
> that
> pulls files, folders and registry keys of installed programs. I'm
> wanting to
> with a context menu selection of "Delete Selected", delete "ALL" of the
> checked selected files, folders, registry keys. Can someone show me
> some code
> to do this please?

I don't have the time to enter a bunch of code, but basically you can
use the File.Delete method to delete files, Directory.Delete method to
delete folders, and the RegistryKey.DeleteValue,
RegistryKey.DeleteSubKey or RegistryKey.DeleteSubKeyTree (depending on
your needs) to delete registry entries.

Help has samples for all.


Jun 28 '06 #6
Just print out what is returned by FileList.ToString. You'll see this is not
what you expect (it prints out the class name).

(plus FileList is empty and I'm not sure what a FileList have to do with
registry key names but this is not the problem for now).

As you see we would never have spotted this without seeing YOUR code...

Hope it helps.

---
Patrice

"eSolTec, Inc. 501(c)(3)" <eS*************@discussions.microsoft.com> a
écrit dans le message de news:
5B**********************************@microsoft.com...
Patrice,

Thank you for your tips. I greatly appreciate it.

VB 2005
Treeview: tv_Results
Code:
If MessageBox.Show("Delete all selected registry keys?",
"Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.Yes Then
Dim FileList As ArrayList

My.Computer.Registry.CurrentUser.DeleteSubKey(File List.ToString)

End If

Most of the keys are from programs that would be considered rogue or
stuborn
to find an uninstaller or to uninstall from a computer. I'm building a
tech
tool for my non-profit organization. Using messagebox to confirm the
delete
first as you can see.

"Patrice" wrote:
Try something like :
My.Computer.Registry.CurrentUser.DeleteSubKeyTree( "Software\MyCompany")

My.Computer.FileSystem.DeleteDirectory("c:\MyDirec tory",
FileIO.DeleteDirectoryOption.DeleteAllContents)

Generally it's always better that YOU show us what you do. For example
my
first thought would be that you try to delete something you are not
allowed
to delete (in which case our code wouldn't work better, also we could
provide VB2005 code when you are using VB 2003).

Also please always include an accurate description of the result you have
instead of just saying it didn't work...

--
Patrice

"eSolTec, Inc. 501(c)(3)" <eS*************@discussions.microsoft.com> a
écrit dans le message de news:
66**********************************@microsoft.com...
> Zack,
>
> thank you for your reply, but I'm using a treeview with an array in it
> and
> the RegistryKey.Delete from MyComputer didn't work. So I would
> appreciate
> someone either taking the time to show me some code for deleting files,
> folders and registry keys. Thank you again for any and all assistance.
>
> "za***@construction-imaging.com" wrote:
>
>>
>> eSolTec wrote:
>> > Thank you in advance for any and all assistance. I have an
>> > application
>> > that
>> > pulls files, folders and registry keys of installed programs. I'm
>> > wanting to
>> > with a context menu selection of "Delete Selected", delete "ALL" of
>> > the
>> > checked selected files, folders, registry keys. Can someone show me
>> > some code
>> > to do this please?
>>
>> I don't have the time to enter a bunch of code, but basically you can
>> use the File.Delete method to delete files, Directory.Delete method to
>> delete folders, and the RegistryKey.DeleteValue,
>> RegistryKey.DeleteSubKey or RegistryKey.DeleteSubKeyTree (depending on
>> your needs) to delete registry entries.
>>
>> Help has samples for all.
>>
>>


Jun 28 '06 #7

eSolTec wrote:
Patrice,

Thank you for your tips. I greatly appreciate it.

VB 2005
Treeview: tv_Results
Code:
If MessageBox.Show("Delete all selected registry keys?",
"Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.Yes Then
Dim FileList As ArrayList
My.Computer.Registry.CurrentUser.DeleteSubKey(File List.ToString)

End If
FileList is an arraylist. DeleteSubKey takes a single sub key name in a
string. If the FileList array contains a list of string values that
represent the names of sub keys to delete, something this should work:

Dim sFile as String

For Each sFile in FileList
My.Computer.Registry.CurrentUser.DeleteSubKey(sFil e)
Next


Most of the keys are from programs that would be considered rogue or stuborn
to find an uninstaller or to uninstall from a computer. I'm building a tech
tool for my non-profit organization. Using messagebox to confirm the delete
first as you can see.

"Patrice" wrote:
Try something like :
My.Computer.Registry.CurrentUser.DeleteSubKeyTree( "Software\MyCompany")

My.Computer.FileSystem.DeleteDirectory("c:\MyDirec tory",
FileIO.DeleteDirectoryOption.DeleteAllContents)

Generally it's always better that YOU show us what you do. For examplemy
first thought would be that you try to delete something you are not allowed
to delete (in which case our code wouldn't work better, also we could
provide VB2005 code when you are using VB 2003).

Also please always include an accurate description of the result you have
instead of just saying it didn't work...

--
Patrice

"eSolTec, Inc. 501(c)(3)" <eS*************@discussions.microsoft.com> a
écrit dans le message de news:
66**********************************@microsoft.com...
Zack,

thank you for your reply, but I'm using a treeview with an array in it and
the RegistryKey.Delete from MyComputer didn't work. So I would appreciate
someone either taking the time to show me some code for deleting files,
folders and registry keys. Thank you again for any and all assistance.

"za***@construction-imaging.com" wrote:

>
> eSolTec wrote:
> > Thank you in advance for any and all assistance. I have an application
> > that
> > pulls files, folders and registry keys of installed programs. I'm
> > wanting to
> > with a context menu selection of "Delete Selected", delete "ALL" of the
> > checked selected files, folders, registry keys. Can someone show me
> > some code
> > to do this please?
>
> I don't have the time to enter a bunch of code, but basically you can
> use the File.Delete method to delete files, Directory.Delete method to
> delete folders, and the RegistryKey.DeleteValue,
> RegistryKey.DeleteSubKey or RegistryKey.DeleteSubKeyTree (depending on
> your needs) to delete registry entries.
>
> Help has samples for all.
>
>




Jun 28 '06 #8

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

Similar topics

2
by: entoone | last post by:
I am able to make a selection of information when entering a record, with radio buttons giving the option of yes, or no. Which stores their answer as yes, or no in the database. I then have an...
1
by: tabonni | last post by:
Hi all I want to create an ASP page, which can copy the real PDF files into the clipboard and then the user can paste it in Outlook message as attachments(it's like inserting attachments) My...
3
by: TJS | last post by:
if country other than us is selected, I want to show only wire transfer as payment option. can someone help me get this "deleteoptions" code to work ? ==========================================...
5
by: Mojtaba Faridzad | last post by:
Hi, with SetDataBinding( ) a DataGrid shows a DataView. user can select some rows in the grid by holding cotrol key. when user clicks on Delete button, I should delete all selected rows. I am...
1
by: jez123456 | last post by:
Hi, I have a windows form with a listbox control. My code all works correctly when deleting an item from the listbox except the last item. I get the following message when trying to delete the...
0
by: Hrvoje Vrbanc | last post by:
Hello, this is a problem I came upon while building a site based on MCMS 2002 but it's not strictly MCMS-oriented: I have a page that displays a certain content in presentation mode but when an...
4
by: Lisa | last post by:
Hey all, I've spent an hour reading posts to see how to delete a row in a datagrid but none of them work for me (most are VB.NET and I'm coding in C#). Specifically, I have a checkbox next to each...
10
by: A_PK | last post by:
I am writing mobile application using Vb.net when i click the last row of list view, and try to delete it.... will promtpy the following message "Additional information:...
6
by: keeps21 | last post by:
I'm having a bit of trouble creating a page to delete a story from the content table in my database. I have checked my DELETE query directly in phpmyadmin and it is working fine. I am echoing...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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:
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.