chris6user
Programmer
This is a code from my ActiveX, module name is Combo.cls
Private m_ListValue() As String
Private m_RecCount As Long
Public Property Let RecCount(ByVal vData As String)
m_RecCount = vData
End Property
Public Property Get RecCount() As String
RecCount = m_RecCount
End Property
Public Property Let ListValue(Index As Integer, ByVal vData As String)
m_ListValue(Index) = vData
End Property
Public Property Get ListValue(Index As Integer) As String
ListValue(Index) = m_ListValue(Index)
End Property
Function GetValues() As String
Dim adoRs As New ADODB.Recordset
Dim i As Integer
Set adoRs = New ADODB.Recordset
adoRs.Open "Select filetype from Function", Conn, adOpenKeyset, adLockOptimistic
If Not adoRs.EOF Then
adoRs.MoveLast
adoRs.MoveFirst
m_RecCount = adoRs.RecordCount - 1
ReDim m_ListValue(adoRs.RecordCount - 1)
Do While Not adoRs.EOF
m_ListValue(i) = adoRs.Fields(0)
i = i + 1
If i > adoRs.RecordCount - 1 Then Exit Do
adoRs.MoveNext
Loop
Else
End If
Now the question, why when I call my object in the vb application it gives me the right number of records, but all the values are empty?
I try to get it like this:
dim ComboValues as new Combo
ComboValues.GetValues
For iCount = 0 To tdgbox.RecCount
cmbTDG.AddItem ComboValues.ListValue(iCount)
Next
ListValue is always empty! Why?
Private m_ListValue() As String
Private m_RecCount As Long
Public Property Let RecCount(ByVal vData As String)
m_RecCount = vData
End Property
Public Property Get RecCount() As String
RecCount = m_RecCount
End Property
Public Property Let ListValue(Index As Integer, ByVal vData As String)
m_ListValue(Index) = vData
End Property
Public Property Get ListValue(Index As Integer) As String
ListValue(Index) = m_ListValue(Index)
End Property
Function GetValues() As String
Dim adoRs As New ADODB.Recordset
Dim i As Integer
Set adoRs = New ADODB.Recordset
adoRs.Open "Select filetype from Function", Conn, adOpenKeyset, adLockOptimistic
If Not adoRs.EOF Then
adoRs.MoveLast
adoRs.MoveFirst
m_RecCount = adoRs.RecordCount - 1
ReDim m_ListValue(adoRs.RecordCount - 1)
Do While Not adoRs.EOF
m_ListValue(i) = adoRs.Fields(0)
i = i + 1
If i > adoRs.RecordCount - 1 Then Exit Do
adoRs.MoveNext
Loop
Else
End If
Now the question, why when I call my object in the vb application it gives me the right number of records, but all the values are empty?
I try to get it like this:
dim ComboValues as new Combo
ComboValues.GetValues
For iCount = 0 To tdgbox.RecCount
cmbTDG.AddItem ComboValues.ListValue(iCount)
Next
ListValue is always empty! Why?