Results 1 to 4 of 4

Thread: vb class files

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Posts
    143
    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.


  2. #2
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Sydney Australia
    Posts
    476

    VB Class Files

    The problem is the "%"

    Try

    Private m_numToAdd as integer

  3. #3
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    NY
    Posts
    497
    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 %.

    end war
    stop greed

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Posts
    143

    Thumbs up

    Yeh that does work. Thanks.
    I didnt think vb would have a fit about that

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width