zunebuggy65
Active member
- Joined
- Oct 12, 2023
- Messages
- 42
- Programming Experience
- 3-5
I have a save file dialog box. When a user selects a folder to save in, I would like the program to check the drive type and if it is CD type, ask them to select a different drive. It doesn't appear I can detect if it is a writable CD or not, so I'll opt with excluding CD types altogether. Here is one of many things I've tried. I've tried DriveType as well as DriveInfo. The MsgBox statement is just temporary for debugging. I have looked for good examples online but it seems I don't even know what to pass to DriveType and DriveInfo or read it to find out what type of drive the user chose. I keep getting exceptions no matter what I try. I thought the DriveInfo or DriveType would be a string or an integer, but one of the exceptions I got was "could not convert DriveType to String and integer errored out as well.
I don't need to check all the drives, just the drive the user has selected.
I did declare all the variables shown here for the filenames, they are just declared publicly.
Thank you
I don't need to check all the drives, just the drive the user has selected.
VB.NET:
Dim Drive_Info As System.IO.DriveInfo
Dim Drive_letter As IO.DriveInfo
If savFile.ShowDialog() = DialogResult.OK Then
myFilePath = IO.Path.GetDirectoryName(savFile.FileName)
myFileFile = IO.Path.GetFileName(savFile.FileName)
myFNOnly = IO.Path.GetFileNameWithoutExtension(savFile.FileName)
Drive_letter = IO.DriveInfo.GetDrives(myFilePath)
Drive_Info = New System.IO.DriveInfo(Drive_letter)
MsgBox(Drive_Info)
Return True
Else
Return False
End If
I did declare all the variables shown here for the filenames, they are just declared publicly.
Thank you