ik heb een programmatje gemaakt om bestanden te kopieren maar het zegt steeds dat hij geen rechten heeft zelfs als ik hem met Administrator uitvoer.
een vriend van me zei het volgende:
ik begrijp niet helemaal wat hij bedoelt, kan iemand me helpen?
Code:
Public Class Form1
Private Sub AfsluitenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Close()
End Sub
Private Sub Backup_knop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Backup_knop.Click
Call trial()
End Sub
Private Sub trial()
If RadioButton1.Checked = True Then
Copy_Folder()
ElseIf RadioButton3.Checked = True Then
Move_Certain_Files_To_New_Folder()
End If
End Sub
Sub Copy_Folder()
'This example copy all files and subfolders from FromPath to ToPath.
'Note: If ToPath already exist it will overwrite existing files in this folder
'if ToPath not exist it will be made for you.
Dim FromPath As String
Dim ToPath As String
FromPath = bronfolderdialog.SelectedPath '<< Change
ToPath = doelfolderdialog.SelectedPath & Format(Now, "yyyy-mm-dd h-mm-ss") '<< Change
FileCopy(FromPath, ToPath)
'If you want to create a backup of your folder every time you run this macro
'you can create a unique folder with a Date/Time stamp.
'ToPath = "C:\Users\Ron\" & Format(Now, "yyyy-mm-dd h-mm-ss")
End Sub
Sub Move_Certain_Files_To_New_Folder()
'This example move all Excel files from FromPath to ToPath.
'Note: It will create the folder ToPath for you with a date-time stamp
Dim FromPath As String
Dim ToPath As String
Dim FileExt As String
FromPath = "D:\Gedeeld\hoi" '<< Change
ToPath = "D:\Gedeelde mappen" & Format(Now, "yyyy-mm-dd h-mm-ss") _
& "\" '<< Change only the destination folder
FileExt = "*" & TextBox1.Text '<< Change
'You can use *.* for all files or *.doc for word files
FileCopy(FromPath & FileExt, ToPath)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
bronfolderdialog.ShowDialog()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
doelfolderdialog.ShowDialog()
End Sub
End Class
een vriend van me zei het volgende:
Het probleem is dat het programma niet gemachtigd is om de files te bewerken. Of je moet de variable '*.exe' toevoegen aan de machtigen over de hele pc, wat ik niet aanraad, omdat het ook een virus de kans geeft. Wat je wel zou kunnen proberen is om het programma gewoon te buidlen i.p.v. te debuggen vervolgens zou je het programma moeten kunnen uitvoeren als administrator.
ik begrijp niet helemaal wat hij bedoelt, kan iemand me helpen?