tags:

views:

190

answers:

0

Hi,

How can i use a .exe file in my resources folder? I want to copy the file in the resource folder to another folder.

tried this

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    If (Directory.Exists("Files")) Then
    Else
    End If
    Directory.CreateDirectory("Files")

    Dim FileToCopy As String
    Dim NewCopy As String

    FileToCopy = My.Resources.THEFILEIWANT <- only this part doesn't work
    NewCopy = "Files\THEFILEIWANT.exe"

    If System.IO.File.Exists(FileToCopy) = True Then
        System.IO.File.Copy(FileToCopy, NewCopy)
    End If
End Sub

This is needed so when ther file doesn't exists the file gets created/copied.

Does anyone knows how i can call the file from the resource folder?

Tried this ` Dim writePermission As FileIOPermission writePermission = New FileIOPermission(FileIOPermissionAccess.Write)

    If (SecurityManager.IsGranted(writePermission)) Then

        My.Computer.FileSystem.WriteAllBytes("Files", My.Resources.unscrambler, False)
    End If`

But im getting a invalid permission error.