Home All Groups Group Topic Archive Search About

Deleting All Selected Checked files

Author
28 Jun 2006 1:27 PM
eSolTec, Inc. 501(c)(3)
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?

Author
28 Jun 2006 2:09 PM
zacks
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.
Author
28 Jun 2006 2:23 PM
eSolTec, Inc. 501(c)(3)
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.

Show quoteHide quote
"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.
>
>
Author
28 Jun 2006 2:41 PM
Patrice
Try something like :
My.Computer.Registry.CurrentUser.DeleteSubKeyTree("Software\MyCompany")

My.Computer.FileSystem.DeleteDirectory("c:\MyDirectory",
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)" <eSolTecInc50***@discussions.microsoft.com> a
écrit dans le message de news:
6605C142-AD13-4F54-9445-B84F4EA82***@microsoft.com...
Show quoteHide quote
> 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.
>>
>>
Author
28 Jun 2006 2:53 PM
eSolTec, Inc. 501(c)(3)
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(FileList.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.

Show quoteHide quote
"Patrice" wrote:

> Try something like :
> My.Computer.Registry.CurrentUser.DeleteSubKeyTree("Software\MyCompany")
>
> My.Computer.FileSystem.DeleteDirectory("c:\MyDirectory",
> 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)" <eSolTecInc50***@discussions.microsoft.com> a
> écrit dans le message de news:
> 6605C142-AD13-4F54-9445-B84F4EA82***@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.
> >>
> >>
>
>
>
Author
28 Jun 2006 6:22 PM
Patrice
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)" <eSolTecInc50***@discussions.microsoft.com> a
écrit dans le message de news:
5B6A1468-7460-43E9-9675-EAF0A0327***@microsoft.com...
Show quoteHide quote
> 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(FileList.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:\MyDirectory",
>> 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)" <eSolTecInc50***@discussions.microsoft.com> a
>> écrit dans le message de news:
>> 6605C142-AD13-4F54-9445-B84F4EA82***@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.
>> >>
>> >>
>>
>>
>>
Author
28 Jun 2006 7:24 PM
zacks
eSolTec wrote:
Show quoteHide quote
> 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(FileList.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(sFile)
Next


Show quoteHide quote
>
> 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:\MyDirectory",
> > 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)" <eSolTecInc50***@discussions.microsoft.com> a
> > écrit dans le message de news:
> > 6605C142-AD13-4F54-9445-B84F4EA82***@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.
> > >>
> > >>
> >
> >
> >
Author
28 Jun 2006 2:29 PM
eSolTec, Inc. 501(c)(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.

Show quoteHide quote
"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.
>
>