|
-
Sep 29th, 2000, 08:08 PM
#1
Thread Starter
Hyperactive Member
So far i've created a project to try and learn how to use classes. I've just made it add two numbers. I have it check in the propery let statment if its a numer else set it to 1. When i type a number in it does not fire the code to check it. Here it is if you can help thanks
'on class module
Dim output As Object
Private C_num1 As Integer
Private C_num2 As Integer
Dim thenumber1 As Integer
Dim thenumber2 As Integer
Public Property Get number() As Integer
number1 = C_num1
End Property
Public Property Let number1(number1 As Integer)
If IsNumeric(number) Then
number1 = C_num1
Else
C_num1 = 1
End If
End Property
Public Property Get number2() As Integer
number2 = C_num2
End Property
Public Property Let number2(number2 As Integer)
If IsNumeric(number2) Then
number = C_num2
Else
C_num2 = 1
End If
End Property
Property Set outputdev(indev As Object)
Set output = indev
End Property
Public Sub additup(number1 As Integer, number2 As Integer)
output = number1 + number2
End Sub
Private Sub Class_Initialize()
C_num1 = 0
C_num2 = 0
End Sub
'on the form
Dim myclass As New Class1
Private Sub Command1_Click()
Set myclass.outputdev = lblanswer
thenumber1 = txtnum1.Text
thenumber2 = txtnum2.Text
myclass.additup txtnum1, txtnum2
End Sub
Matt 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|