Inquiridor
Nao consigo remover ficheiros de diretório

Discussão Geral
-
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click If Directory.Exists("C:\Hyrokumata\10A\Start.exe") = True Then Remover() End If If Directory.Exists("C:\Hyrokumata\10A\Updater.exe") = True Then Remover2() End If If Directory.Exists(My.Computer.FileSystem.SpecialDirectories.Desktop & "\Start.lnk") = True Then Remover3() End If End Sub Private Sub Remover() Dim caso1 As String = "C:\Hyrokumata\10A\Start.exe" Try My.Computer.FileSystem.DeleteFile(caso1) Catch e As Exception MsgBox("Erro 001", MsgBoxStyle.Information + vbOK, ":(") End Try End Sub Private Sub Remover2() Dim caso2 As String = "C:\Hyrokumata\10A\Updater.exe" Try My.Computer.FileSystem.DeleteFile(caso2) Catch e As Exception MsgBox("Erro 002", MsgBoxStyle.Information + vbOK, ":(") End Try End Sub Private Sub Remover3() Try My.Computer.FileSystem.DeleteFile(My.Computer.FileSystem.SpecialDirectories.Desktop & "\Start.lnk") Catch e As Exception MsgBox("Erro 003", MsgBoxStyle.Information + vbOK, ":(") End Try End Sub
Ja tentei do mais basico e conclui neste código e nem apaga nada nem mostra mensagens de erro. Que faço ? Normalmente só uso:
Directory.Delete("C:\Hyrokumata\Exemplo")
E funcionava mas nem assim
Meu novo programa (Bloco de Notas) http://hyrokumata-app.blogspot.pt/2012/07/notepad-3-beta.html
Todas as Respostas
-
Veja se assim funciona:
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click If File.Exists("C:\Hyrokumata\10A\Start.exe") = True Then Remover() End If If File.Exists("C:\Hyrokumata\10A\Updater.exe") = True Then Remover2() End If If File.Exists(My.Computer.FileSystem.SpecialDirectories.Desktop & "\Start.lnk") = True Then Remover3() End If End Sub
Visual Studio 2010(Vb.Net)
-
-