|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Deleting All Selected Checked filesThank 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? eSolTec wrote:
> Thank you in advance for any and all assistance. I have an application that I don't have the time to enter a bunch of code, but basically you can> 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? 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. 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. > > 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. >> >> 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. > >> > >> > > > 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. >> >> >> >> >> >> >> eSolTec wrote:
Show quoteHide quote > Patrice, FileList is an arraylist. DeleteSubKey takes a single sub key name in a> > 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 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. > > >> > > >> > > > > > > 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. > >
Control image property locking image file even after image cleared
Losing accented characters getting account names from system screen resolution independent Hide web service in COM interop assembly DataGrid X DataSource Syntax Error Datasets How to include System.Globalization in my VB project What do I need to deploy exe to 98/XP machines supress dialog box of a dll in runtime |
|||||||||||||||||||||||