Getting CD name and file list in VB.net
-
Does anybody know how to get the cd name, (volume name) and to get the files list in the directory? to pass it in a dataset...
-
Does anybody know how to get the cd name, (volume name) and to get the files list in the directory? to pass it in a dataset...
Hi Julien. Well, you can look at the FileInfo.Name[^] documentation for an example of getting the list of files in a directory. The
Dir()
function, though a carryover from VB6, is also available in theMicrosoft.VisualBasic
namespace. As for the volume name, you could try this (where E:\ is your CD drive):Dir("E:\", FileAttribute.Volume)
or I suppose you could add a reference to the Microsoft Scripting Runtime in your vb.net project and use the
FileSystemObject
'sGetDrive()
method. -
Hi Julien. Well, you can look at the FileInfo.Name[^] documentation for an example of getting the list of files in a directory. The
Dir()
function, though a carryover from VB6, is also available in theMicrosoft.VisualBasic
namespace. As for the volume name, you could try this (where E:\ is your CD drive):Dir("E:\", FileAttribute.Volume)
or I suppose you could add a reference to the Microsoft Scripting Runtime in your vb.net project and use the
FileSystemObject
'sGetDrive()
method.Thanks for your help Julien