Making a summary of values?

Well, I have a thing for school due Monday but I'm having a little trouble with it. The project or solution consists of a form and a class. My professor wanted us to transfer all the math to the class and leave the other code in the form, needless to say it's easier said than done.

I am not very experienced with using classes yet and want to accumulate totals that the user has ended up with. Do the variables in the class have to be declared differently than in the form?

Here is what I have so far, it would be great if I could get some much needed help with this.

Comments

I don't know what your project was, or what the math was, but using class objects is actually a pretty easy concept. In VB.Net, all objects you declare are class objects

So:[code]Dim strName as String 'strName is an class object type String'Now String and other similar datatypes are special, but the concepts apply

Class clsTeach

'Typically this area is used to declare variables 'Private var types are variables that can only be used by the functions, 'Sub routines, and properties inside the class object Private _Cool as Boolean = True 'If you just do a Dim, it defaults to Private Dim _Name as String = "firesickle.com"

'Properties are awesome ways to define vartypes. 'In the beginning it seems pretty abstract, but properties allow you to massage data that is coming in and out 'There are a great deal of applications here, I will show one here Public Property Name as String Get Return _Name End Get Set(Value as String) _Name = Value 'Massaging the _Cool variable based on the input to the Name property If Value.tolower = "firesickle.com" then _Cool = True else _Cool = False End If End Set End Property

'ReadOnly properties are used to safely expose private variables Public ReadOnly Property Cool as Boolean Get Return _Cool End get End Property

Sub New()

End Sub

'An override for the Constructor'This way I can declare a new instance of the Class object'without passing data Sub New(F as String, SP as String) _Face = F ShowPub = SP 'If you checked _Cool right now, the value would be True 'Regardless of what you entered for F 'This is because I set it using the _Face reference 'Instead of setting the Face property 'Typically I define the variables with an underscore 'and the properties without, so I know which property goes to 'which variable, but everyone's style is different Face = F 'If you check _Cool here it will have changed if F didn't equal 'firesickle.com End Sub

Public Sub setCool(C as Boolean) 'You can set private vars with a Subroutine _Cool = C End Sub

Public Function getCool() as Boolean 'You can get private vars with a Function Return _Cool End Function

'But why would you want to do this, when you could have just made 'a property (which we did, but readonly so I don't confuse you 'just wanted to show an alternative to exposing private 'vars with codeEnd Class

'This code would go under an event on a formDim T as clsTeach

'If I try to access anything in T it will crash'with a null reference error, this is because class objects'need to be initialized

T = new clsTeach()

'I didn't pass any vars so the New() code got called, which was empty'If I didn't make an empty Sub New() it wouldn't let me pass nothing