I have a problem opening a folder. I have a windows form with several buttons, 2 specifically perform the same function, check if the folder exists in the specified route, delete it if it exists and create it again. In turn decompress some files in the indicated folder and open this. In the VS it works correctly but when I convert it into an exe one of the 2 buttons (which have exactly the same code except the name of the folder) does everything but does not open the folder at the end.
Private Sub Button3_Click_1(sender As Object, e As EventArgs) Handles Button3.Click
If IO.Directory.Exists(My.Application.Info.DirectoryPath & "\Gibraltar") Then
IO.Directory.Delete(My.Application.Info.DirectoryPath & "\Gibraltar", True)
IO.Directory.CreateDirectory(My.Application.Info.DirectoryPath & "\Gibraltar")
Else
IO.Directory.CreateDirectory(My.Application.Info.DirectoryPath & "\Gibraltar")
End If
Try
ZipFile.ExtractToDirectory(My.Application.Info.DirectoryPath & "\Gibraltar_wind.zip", My.Application.Info.DirectoryPath & "\Gibraltar")
Catch ex As Exception
End Try
Process.Start("explorer.exe", My.Application.Info.DirectoryPath & "\Gibraltar")
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
If IO.Directory.Exists(My.Application.Info.DirectoryPath & "\Biscay") Then
IO.Directory.Delete(My.Application.Info.DirectoryPath & "\Biscay", True)
IO.Directory.CreateDirectory(My.Application.Info.DirectoryPath & "\Biscay")
Else
IO.Directory.CreateDirectory(My.Application.Info.DirectoryPath & "\Biscay")
End If
Try
ZipFile.ExtractToDirectory(My.Application.Info.DirectoryPath & "\Biscay_wind.zip", My.Application.Info.DirectoryPath & "\Biscay")
Catch ex As Exception
End Try
Process.Start("explorer.exe", My.Application.Info.DirectoryPath & "\Biscay")
Where have I made the mistake?
Greetings and thanks