Adding a DICOM Data Set to a DICOM Directory for VB.NET

'LEADDicomDS is a DICOM Dataset defined outside this method
Private Sub AddingDICOMDataSetToDICOMDirectory()
   ' The following code snippet demonstrates how to use the LEADTOOLS DICOM
   ' DS COM Object (ILEADDicomDS) to load a Data Set and then add it to a
   ' DICOM Directory
   Dim DicomDir As New LTDICDIRLib.LEADDicomDir

   ' Set the destination folder
   DicomDir.ResetDicomDir("C:\Medical Images")

   ' Load a Data Set and add it to the Directory
   If LEADDicomDS.LoadDS("C:\Medical Images\Image", 0) = LTDicomKernelLib.DicomErrorCodes.DICOM_SUCCESS Then
      DicomDir.InsertDicomDS(LEADDicomDS.hDicomDS, "C:\Medical Images\Image")

      ' Save the DICOMDIR File
      DicomDir.SaveDicomDir()
   End If
End Sub