0

I am using the following command

IO.File.SetAttributes(Pth & FileP, FileAttributes.Hidden)

Its in a module which is called at the sub main but does not change the attributes of the file to hidden. Pth & FileP is a string "E:\Tareek.exe" which is a Usb storage device. The file attribute by default is not read only...

Can someone please tell me what the problem might be?

Ali Haider
  • 21
  • 5

2 Answers2

0

Usually to set "hidden" you add that attribute instead of replacing as shown in MSDN article File.SetAttributes:

 File.SetAttributes(path, File.GetAttributes(path) Or FileAttributes.Hidden)
Alexei Levenkov
  • 96,782
  • 12
  • 124
  • 169
0

Do you have option strict on in your code because you will need to use the + instead of & for string concatenation in your parameter. See this answer

Community
  • 1
  • 1
Victor Frank
  • 29
  • 1
  • 5