Content Supported by Sourcelens Consulting
VERSION 1.0 CLASS
BEGIN
MultiUse = -1
Persistable = 0
DataBindingBehavior = 0
DataSourceBehavior = 1
END
Attribute VB_Name = "MySource"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private rs As ADODB.Recordset
Public Property Get DataMembers() As DataMembers
End Property
Private Sub Class_GetDataMember(DataMember As String, Data As Object)
Set Data = rs
End Sub
Private Sub Class_Initialize()
Dim strPath As String, strName As String
Dim i As Integer
Set rs = New ADODB.Recordset
With rs
.Fields.Append "DirID", adInteger
.Fields.Append "Directory", adBSTR, 255
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open
End With
strPath = "C:\"
strName = Dir(strPath, vbDirectory)
i = 0
Do While strName <> ""
If strName <> "." And strName <> ".." _
And strName <> "pagefile.sys" Then
If (GetAttr(strPath & strName) And _
vbDirectory) = vbDirectory Then
i = i + 1
With rs
.AddNew
.Fields.Item("DirID") = i
.Fields.Item("Directory") = strName
.Update
End With
End If
End If
strName = Dir
Loop
rs.MoveFirst
End Sub
Public Sub Cycle()
rs.MoveNext
If rs.EOF = True Then
rs.MoveFirst
End If
End Sub