-
Hello,
I am having a problem.
Here is my code.
The problem is that it will not let me type in
' Private as integer m_numToAdd%
Private as integer m_Total%'
In the general declerations in my class
Here is the rest of the code.
Code:
Option Explicit
Public Property Get NumToAdd() As Integer
NumToAdd = m_numtoadd%
End Property
Public Property Let NumToAdd(ByVal vNewValue As Integer)
m_numtoadd% = inewvalue
AddNum
End Property
Public Property Get Total() As Integer
Total = m_total%
End Property
Public Property Let Total(ByVal vNewValue As Integer)
m_total% = inewvalue
End Property
Private Sub AddNum()
m_total% = m_numtoadd% + m_total%
End Sub
If anyone can tell me why I can not put the above in General Declerations and or know a link that explains writing class's would help alot.
Thanks in advance.
:)
-
VB Class Files
The problem is the "%"
Try
Private m_numToAdd as integer
-
I noticed that you're setting =inewvalue instead of =vnewvalue which is what you were passing.
If you want to denote integer vs string vs whatever, use hungarian notation:
Private iInteger As Integer
Private sString As String
Private m_vVariant As Variant
Private m_lLong As Long
(etc. I'm sure you can look it up somewhere)
and lose the %.
-
Yeh that does work. Thanks.
I didnt think vb would have a fit about that :)