InvalidEnumArgumentsException Error <Help Requested>

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

invalidEnumArgumentException error during run-time, it builds OK...didn't
like when I added fileio.uicanceloption.throwExceptions

any ideas..?

thanks in advance!!

Try

FileIO.FileSystem.DeleteDirectory(strLocString,
FileIO.DeleteDirectoryOption.DeleteAllContents,
FileIO.UICancelOption.ThrowException)

Catch e As System.IO.IOException
MessageBox.Show("Error deleteing " & strLocString & " directory"
& ControlChars.CrLf & e.Message, " Error In Creation")


End Try
 
magellan said:
invalidEnumArgumentException error during run-time, it builds OK...didn't
like when I added fileio.uicanceloption.throwExceptions

any ideas..?

thanks in advance!!

Try

FileIO.FileSystem.DeleteDirectory(strLocString,
FileIO.DeleteDirectoryOption.DeleteAllContents,
FileIO.UICancelOption.ThrowException)

Catch e As System.IO.IOException
MessageBox.Show("Error deleteing " & strLocString & "
directory"
& ControlChars.CrLf & e.Message, " Error In Creation")


End Try

You are passing the wrong enumeration value for the third parameter of
DeleteDirectory. DeleteDirectory has 3 overloads:

DeleteDirectory(String, DeleteDirectoryOption)
DeleteDirectory(String, UIOption, RecycleOption)
DeleteDirectory(String, UIOption, RecycleOption, UICancelOption)

If you want to make use of the UICancelOption parameter, you'll have to call
the 3rd overload by passing all four parameters (directory, showUI, recycle,
and onUserCancel).

HTH,
Mythran
 
Back
Top