I have a class file that stores each control for a series of userform comboboxes and textboxes
Class module: materialField
I am using a for loop to put the information into each instance of the class as below.
stores the first column of the combobox
throws an error
I need to get at this value and store it using only the name or type property. I know I am missing something please help me figure it out. Thank you in advance.
Class module: materialField
Code:
Option Explicit
Private fieldName As String
Private fieldValue As Variant
Private fieldValue2 As String
Property Get Name() As String
Name = fieldName
End Property
Property Get Value() As Variant
Value = fieldValue
End Property
Property Get value2() As String
value2 = fieldValue2
End Property
Property Let Name(str As String)
fieldName = str
End Property
Property Let Value(val As Variant)
fieldValue = val
End Property
Property Let value2(str As String)
fieldValue2 = str
End Property
I am using a for loop to put the information into each instance of the class as below.
Code:
Option Explicit
Private mats(1 To 10, 1 To 3) As MaterialField
Private Sub FillTblArray()
Dim i As Integer
Dim j As Integer
Dim str As String
For i = 1 To 10
For j = 1 To 3
Set mats(i, j) = New MaterialField
If (j = 1) Then
str = "CB" & i
mats(i, j).Name = str
mats(i, j).Value = Me.Controls(str).Value
mats(i, j).value2 = Me.Controls(str).Column(1).Value
Else
str = "TB" & i & (j - 1)
mats(i, j).Name = str
mats(i, j).Value = Me.Controls(str).Value
End If
Next j
Next i
End Sub
Code:
mats(i, j).Value = Me.Controls(str).Value
Code:
mats(i, j).value2 = Me.Controls(str).Column(1).Value
I need to get at this value and store it using only the name or type property. I know I am missing something please help me figure it out. Thank you in advance.