D
Devon_Nullman
Guest
I want to set the RootFolder to a "Master" folder that the user has already selected, but the RootFolder expects an Environment,SpecialFolder, which is an enum (integer).
Option Strict On wants to cast it but that fails ("FBD" is a FolderBrowserDialog)
'Original
If Directory.Exists(MasterFolder) Then
FBD.RootFolder = MasterFolder
End If
'Opt Strict changes
If Directory.Exists(MasterFolder) Then
FBD.RootFolder = CType(MasterFolder, Environment.SpecialFolder)
End If
When I run the program, it halts there with this exception:
System.InvalidCastException
HResult=0x80004002
Message=Conversion from string "C:\Users\devon\source\repos" to type 'Integer' is not valid.
Inner Exception 1:
FormatException: Input string was not in a correct format.
Is there any way to fix this? I am setting the FBD.SelectedPath but it's not 100% what I want.
There is no Environment.Special folder for the Visual Studio source repository, in my case that is
C:\users\devon\source\repos
Continue reading...
Option Strict On wants to cast it but that fails ("FBD" is a FolderBrowserDialog)
'Original
If Directory.Exists(MasterFolder) Then
FBD.RootFolder = MasterFolder
End If
'Opt Strict changes
If Directory.Exists(MasterFolder) Then
FBD.RootFolder = CType(MasterFolder, Environment.SpecialFolder)
End If
When I run the program, it halts there with this exception:
System.InvalidCastException
HResult=0x80004002
Message=Conversion from string "C:\Users\devon\source\repos" to type 'Integer' is not valid.
Inner Exception 1:
FormatException: Input string was not in a correct format.
Is there any way to fix this? I am setting the FBD.SelectedPath but it's not 100% what I want.
There is no Environment.Special folder for the Visual Studio source repository, in my case that is
C:\users\devon\source\repos
Continue reading...