I am not too familiar with working with visual basic class objects (but worked with C++ class objects before). I'm trying to modify another developer's code separately, so I am trying to incorporate a minimal class definition required to help myself with the development. Given the following subroutine:
Sub ifctStage_class_test()
On Error GoTo localErr ' Error Handling
Dim filepath As String ' for file manipulation
Dim testStages() As ifctStage
Set testStages(0) = New ifctStage
Exit Sub
localErr: 'only operates correctly if user is operating on Angstrom network with smtp server setup
MsgBox "error occurred"
Exit Sub
End Sub
with the following class declaration:
'Angstrom Power
'Data Analysis Tool v0.1
'Programmer: Bruno Bate, Stanley Lee
'Created: 08/03/07 [mm/dd/yyyy]
'Last Modified: 14/11/07
'Overview: class pertaining to each stage of an AFCT test. An instance of the class is called
'whenever a new stage is encountered.
Option Explicit
Private rawStageData(5, 1000000) As Double 'array holding .csv file data
'variables for info stored in headers
Dim UUT As String ' Fuel Cell Identifier
Dim teststation As Integer ' test station identifier
Dim mode As String ' test mode
Dim setPoint As Double ' current set-point
Dim sampleT As Long ' Sampling period
Dim startTime As String ' Start Date and Time
Dim comment As String ' comments
Dim numSamples As Long ' number of samples
'placeholder variables for columns.Referencing these will clean code and simplify reading
Private xStage As Long 'Stage column placeholder
Private xTime As Long 'time column placeholder
Private xVoltage As Long 'voltage column placeholder
Private xCurrent As Long 'current column placeholder
Private xT1 As Long 'T1 temperature column placeholder
Private xT2_Mflow As Long 'T2/Mass Flow colum placeholder
Private xPower As Long 'power column placeholder
'Subroutine executed when new instance of class created
Private Sub Class_Initialize()
'initialize public class variables
UUT = "blank"
teststation = 0
sampleT = 0
mode = "blank"
setPoint = 0
startTime = "blank"
xStage = 0
xTime = 1
xVoltage = 2
xCurrent = 3
xT1 = 4
xT2_Mflow = 5
xPower = 6
End Sub
Is there something missing in the class definition in order to have my subroutine working?
Bookmarks