shawngilbert
asked on
Well, I am stuck again.
I previously received help on problems with my class/methods.
Now, I am having problems with my colllection code.
I am copying this code, through a step-by-step tutorial, from an Advanced VB book.
I receive the error, "Method or data member not found" on the mDispensaryItems.Add listed below.
Private Sub cmdAdd_Click()
'Add an item to the collection
If cboFrameSize.ListIndex <> -1 And cboFrameStyle.ListIndex <> -1 Then
mDispensaryItems.Add cboFrameStyle.ListIndex + 1, cboFrameSize.ListIndex + 1, Val(txtQuantity.Text)
Else
MsgBox "Enter values for the item.", vbInformation, "Dispensary Items"
End If
cmdClear_Click 'clear out form controls
End Sub
Can someone help me identify where I went wrong? I am sure it is something I left out, but as I am teaching myself, I do not really know where to go from here.
Now, I am having problems with my colllection code.
I am copying this code, through a step-by-step tutorial, from an Advanced VB book.
I receive the error, "Method or data member not found" on the mDispensaryItems.Add listed below.
Private Sub cmdAdd_Click()
'Add an item to the collection
If cboFrameSize.ListIndex <> -1 And cboFrameStyle.ListIndex <> -1 Then
mDispensaryItems.Add cboFrameStyle.ListIndex + 1, cboFrameSize.ListIndex + 1, Val(txtQuantity.Text)
Else
MsgBox "Enter values for the item.", vbInformation, "Dispensary Items"
End If
cmdClear_Click 'clear out form controls
End Sub
Can someone help me identify where I went wrong? I am sure it is something I left out, but as I am teaching myself, I do not really know where to go from here.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Oh dear. You are correct.
I reread it and my Add method WAS declared as Private.
Thank you so very much!
I reread it and my Add method WAS declared as Private.
Thank you so very much!
ASKER
In my collection, I have
Private mDispensaryItems As Collection
and I have
Private Sub Add(ByVal intFrameStyle As Integer, ByVal intFrameSize As Integer, ByVal intQuantity As Integer)
But in my form's code, if I type mDispensaryItems. it only displays Count, Item, NewEnum and Remove as options.
I am trying to learn classes and collections, but finding it very difficult.