Deleting All Selected Checked files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • eSolTec, Inc. 501(c)(3)

    #1

    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?
  • zacks@construction-imaging.com

    #2
    Re: Deleting All Selected Checked files


    eSolTec wrote:[color=blue]
    > 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?[/color]

    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.

    Comment

    • eSolTec, Inc. 501(c)(3)

      #3
      Re: Deleting All Selected Checked files

      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.

      "zacks@construc tion-imaging.com" wrote:
      [color=blue]
      >
      > eSolTec wrote:[color=green]
      > > 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?[/color]
      >
      > 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.
      >
      >[/color]

      Comment

      • eSolTec, Inc. 501(c)(3)

        #4
        Re: Deleting All Selected Checked files

        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.

        "zacks@construc tion-imaging.com" wrote:
        [color=blue]
        >
        > eSolTec wrote:[color=green]
        > > 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?[/color]
        >
        > 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.
        >
        >[/color]

        Comment

        • Patrice

          #5
          Re: Deleting All Selected Checked files

          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)" <eSolTecInc501c 3@discussions.m icrosoft.com> a
          écrit dans le message de news:
          6605C142-AD13-4F54-9445-B84F4EA8210B@mi crosoft.com...[color=blue]
          > 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.
          >
          > "zacks@construc tion-imaging.com" wrote:
          >[color=green]
          >>
          >> eSolTec wrote:[color=darkred]
          >> > 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?[/color]
          >>
          >> 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.
          >>
          >>[/color][/color]


          Comment

          • eSolTec, Inc. 501(c)(3)

            #6
            Re: Deleting All Selected Checked files

            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:
            [color=blue]
            > 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)" <eSolTecInc501c 3@discussions.m icrosoft.com> a
            > écrit dans le message de news:
            > 6605C142-AD13-4F54-9445-B84F4EA8210B@mi crosoft.com...[color=green]
            > > 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.
            > >
            > > "zacks@construc tion-imaging.com" wrote:
            > >[color=darkred]
            > >>
            > >> 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.
            > >>
            > >>[/color][/color]
            >
            >
            >[/color]

            Comment

            • Patrice

              #7
              Re: Deleting All Selected Checked files

              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)" <eSolTecInc501c 3@discussions.m icrosoft.com> a
              écrit dans le message de news:
              5B6A1468-7460-43E9-9675-EAF0A0327E71@mi crosoft.com...[color=blue]
              > 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:
              >[color=green]
              >> 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)" <eSolTecInc501c 3@discussions.m icrosoft.com> a
              >> écrit dans le message de news:
              >> 6605C142-AD13-4F54-9445-B84F4EA8210B@mi crosoft.com...[color=darkred]
              >> > 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.
              >> >
              >> > "zacks@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.
              >> >>
              >> >>[/color]
              >>
              >>
              >>[/color][/color]


              Comment

              • zacks@construction-imaging.com

                #8
                Re: Deleting All Selected Checked files


                eSolTec wrote:[color=blue]
                > 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[/color]

                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

                [color=blue]
                >
                > 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:
                >[color=green]
                > > 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)" <eSolTecInc501c 3@discussions.m icrosoft.com> a
                > > écrit dans le message de news:
                > > 6605C142-AD13-4F54-9445-B84F4EA8210B@mi crosoft.com...[color=darkred]
                > > > 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.
                > > >
                > > > "zacks@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.
                > > >>
                > > >> [/color]
                > >
                > >
                > >[/color][/color]

                Comment

                Working...