473,763 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1834

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.Delet e method to
delete folders, and the RegistryKey.Del eteValue,
RegistryKey.Del eteSubKey or RegistryKey.Del eteSubKeyTree (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.Del ete 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***@construc tion-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.Delet e method to
delete folders, and the RegistryKey.Del eteValue,
RegistryKey.Del eteSubKey or RegistryKey.Del eteSubKeyTree (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 programmaticall y delete from their locations. Any
help for code would be greatly appreicated. Most are Registry Keys that I
wish to programmaticall y delete. I have looked at System.IO and also the
RegistryKey.Del ete in the MyComputer Class and nothing so far has worked.

"za***@construc tion-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.Delet e method to
delete folders, and the RegistryKey.Del eteValue,
RegistryKey.Del eteSubKey or RegistryKey.Del eteSubKeyTree (depending on
your needs) to delete registry entries.

Help has samples for all.

Jun 28 '06 #4
Try something like :
My.Computer.Reg istry.CurrentUs er.DeleteSubKey Tree("Software\ MyCompany")

My.Computer.Fil eSystem.DeleteD irectory("c:\My Directory",
FileIO.DeleteDi rectoryOption.D eleteAllContent s)

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.m icrosoft.com> a
écrit dans le message de news:
66************* *************** **...icrosof t.com...
Zack,

thank you for your reply, but I'm using a treeview with an array in it and
the RegistryKey.Del ete 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***@construc tion-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.Delet e method to
delete folders, and the RegistryKey.Del eteValue,
RegistryKey.Del eteSubKey or RegistryKey.Del eteSubKeyTree (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?",
"Confirmati on", MessageBoxButto ns.YesNo, MessageBoxIcon. Question,
MessageBoxDefau ltButton.Button 2) = Windows.Forms.D ialogResult.Yes Then
Dim FileList As ArrayList
My.Computer.Reg istry.CurrentUs er.DeleteSubKey (FileList.ToStr ing)

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.Reg istry.CurrentUs er.DeleteSubKey Tree("Software\ MyCompany")

My.Computer.Fil eSystem.DeleteD irectory("c:\My Directory",
FileIO.DeleteDi rectoryOption.D eleteAllContent s)

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.m icrosoft.com> a
écrit dans le message de news:
66************* *************** **...icrosof t.com...
Zack,

thank you for your reply, but I'm using a treeview with an array in it and
the RegistryKey.Del ete 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***@construc tion-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.Delet e method to
delete folders, and the RegistryKey.Del eteValue,
RegistryKey.Del eteSubKey or RegistryKey.Del eteSubKeyTree (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.ToStri ng. 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.m icrosoft.com> a
écrit dans le message de news:
5B************* *************** **...icrosof t.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?",
"Confirmati on", MessageBoxButto ns.YesNo, MessageBoxIcon. Question,
MessageBoxDefau ltButton.Button 2) = Windows.Forms.D ialogResult.Yes Then
Dim FileList As ArrayList

My.Computer.Reg istry.CurrentUs er.DeleteSubKey (FileList.ToStr ing)

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.Reg istry.CurrentUs er.DeleteSubKey Tree("Software\ MyCompany")

My.Computer.Fil eSystem.DeleteD irectory("c:\My Directory",
FileIO.DeleteDi rectoryOption.D eleteAllContent s)

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.m icrosoft.com> a
écrit dans le message de news:
66************* *************** **...icrosof t.com...
> Zack,
>
> thank you for your reply, but I'm using a treeview with an array in it
> and
> the RegistryKey.Del ete 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***@construc tion-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.Delet e method to
>> delete folders, and the RegistryKey.Del eteValue,
>> RegistryKey.Del eteSubKey or RegistryKey.Del eteSubKeyTree (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?",
"Confirmati on", MessageBoxButto ns.YesNo, MessageBoxIcon. Question,
MessageBoxDefau ltButton.Button 2) = Windows.Forms.D ialogResult.Yes Then
Dim FileList As ArrayList
My.Computer.Reg istry.CurrentUs er.DeleteSubKey (FileList.ToStr ing)

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.Reg istry.CurrentUs er.DeleteSubKey (sFile)
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.Reg istry.CurrentUs er.DeleteSubKey Tree("Software\ MyCompany")

My.Computer.Fil eSystem.DeleteD irectory("c:\My Directory",
FileIO.DeleteDi rectoryOption.D eleteAllContent s)

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.m icrosoft.com> a
écrit dans le message de news:
66************* *************** **...icrosof t.com...
Zack,

thank you for your reply, but I'm using a treeview with an array in it and
the RegistryKey.Del ete 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***@construc tion-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.Delet e method to
> delete folders, and the RegistryKey.Del eteValue,
> RegistryKey.Del eteSubKey or RegistryKey.Del eteSubKeyTree (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
9809
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 update record page that reads information in the database, and presently it will not retrieve the previously selected option from the database. I have tried all sorts of if else statements, and can't get anything to work. I want the previously...
1
2559
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 idea is: When user checked the checkboxes for the requested PDF files from ASP page and press the "Add To Clipboard" button, all requested PDF files will be copied into clipboard. Then, the user open MS outlook message and right click -> Paste all...
3
1456
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 ? ========================================== <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head>
5
14741
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 trying to delete these lines from the dataview like this: for (int i=0; i < dataView.Count; i++) if (dataGrid.IsSelected(i)) dataView.Delete(i);
1
7902
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 last item:- Specified argument was out of the range of valid values. Parameter name: '64' is not a valid value for 'Value'. The 64 reduces depending on how many listbox items are displayed.
0
1413
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 editor clicks "Switch To Edit Site" in MCMS console on the page, the page displays a different content, an interface that editor use for upload and deleting files on the web server. There are no problems with the upload but there is a problem...
4
1576
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 row and a "Delete" button at the bottom. What I want is for each row that is checked to get deleted on the click event.... this is what I got.. <asp:datagrid id="grdUpload" runat="server" DataKeyField="UploadID" AutoGenerateColumns="false"...
10
4403
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: ArgumentOutOfRangeException" what does that mean ? I can delete any row without problem but except last row only....
6
1804
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 the query to check that it comes out as expected and it looks fine. The problem seems to be that when my code is run the record never gets deleted. Meaning that mysql_affected_rows() is always -1 and therefore an error message - 'Could not...
0
10145
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7366
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.