C
C#2y ago
Jana ♡

✅ Help..

help me fix the code
37 Replies
Jana ♡
Jana ♡OP2y ago
Hi guys
Buddy
Buddy2y ago
$details
MODiX
MODiX2y ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Jana ♡
Jana ♡OP2y ago
code :
//remove theme
string Theme;
Theme = @"C:/TrexLauncher Minecraf Bedrock/Launcher/Theme/Theme";
File.Delete(Theme);
this.Close();
//remove theme
string Theme;
Theme = @"C:/TrexLauncher Minecraf Bedrock/Launcher/Theme/Theme";
File.Delete(Theme);
this.Close();
but i got the error :
System.UnauthorizedAccessException: 'Access to the path 'C:\TrexLauncher Minecraft Bedrock\Launcher\Theme\Theme' is denied.'
System.UnauthorizedAccessException: 'Access to the path 'C:\TrexLauncher Minecraft Bedrock\Launcher\Theme\Theme' is denied.'
Buddy
Buddy2y ago
Did you run it as admin?
Jana ♡
Jana ♡OP2y ago
no
Buddy
Buddy2y ago
Try that.
Jana ♡
Jana ♡OP2y ago
how to run it as admin ?
Buddy
Buddy2y ago
Run Visual Studio as admin that will make all programs you debug admin
Jana ♡
Jana ♡OP2y ago
oky
Jana ♡
Jana ♡OP2y ago
Jana ♡
Jana ♡OP2y ago
Same @Buddy
Buddy
Buddy2y ago
Oh, you want to delete a directory?
Jana ♡
Jana ♡OP2y ago
yes
Buddy
Buddy2y ago
Oh, lol. Use Directory.Delete
Jana ♡
Jana ♡OP2y ago
;-; tysm bro u saved my life
Jana ♡
Jana ♡OP2y ago
Jana ♡
Jana ♡OP2y ago
nvm u destroyed my life lmao
Jana ♡
Jana ♡OP2y ago
@Buddy
Buddy
Buddy2y ago
Check overload
Jana ♡
Jana ♡OP2y ago
what is overload ? catclown
Buddy
Buddy2y ago
The ability to redefine a function in different forms (method overloading), for example: One method takes only in a string argument, the overload method maybe takes in an array of characters.
Jana ♡
Jana ♡OP2y ago
us no result ; /
Buddy
Buddy2y ago
$paste
MODiX
MODiX2y ago
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
Buddy
Buddy2y ago
Post your current code
Jana ♡
Jana ♡OP2y ago
full code ?
Buddy
Buddy2y ago
Nah, just the important parts. Like what was posted above Specifically where you call Directory.Delete
Jana ♡
Jana ♡OP2y ago
okay
Jana ♡
Jana ♡OP2y ago
BlazeBin - oqvahemppfbu
A tool for sharing your source code with the world!
Buddy
Buddy2y ago
You did not use the overload
FusedQyou
FusedQyou2y ago
Did you bother clicking this link at all? Same thing with your previous thread, atleast put some effort into it and don't respond with "Doesn't work" whilst not giving any context
Jana ♡
Jana ♡OP2y ago
i used this string ThemePath = (@"C:/TrexLauncher Minecraft Bedrock/Launcher/Theme/Theme"); try { Directory.Delete(ThemePath, true); } catch (IOException) { Thread.Sleep(0); Directory.Delete(ThemePath, true); } this.Close(); it works
Buddy
Buddy2y ago
Good! Exactly what I was pointing towards! 😄
FusedQyou
FusedQyou2y ago
What is the point of the catch statement?
Want results from more Discord servers?
Add your server