Reply to Redim'ing Array of Class Objects
I have tried declaring object in the array dec but have problems latter setting the object to the specific class I want
Sorry, my mistake here, I actually have Redim Preserve in my code
Trouble=
Err Num: -2147211505
Err Comment: "An unkown error has occured!"
Top part of my function is as follows,
Public Function AddSite(ByVal SiteName As String, ByVal SiteCode As String, ByVal BR As Integer, ByVal Zone As Integer) As Boolean
On Error GoTo AddSiteErr
MsgBox "starting addsite "
DoEvents
MsgBox "still starting addsite"
If intSiteCount = 0 Then
* ReDim mvararrSite(1) ' As New clsSite
Else
ReDim Preserve mvararrSite(UBound(mvararrSite) + 1)
End If
MsgBox "Just redimmed "
mvararrSite(UBound(mvararrSite)).strSiteName = SiteName
mvararrSite(UBound(mvararrSite)).strSiteCode = SiteCode
MsgBox "About to increment mvarintsite"
DoEvents
etc etc
It dies at *
The msgbox's and doevents were there to try and see where the hickup is, they don't work! Even putting breakpoints at these msgbox s the error is raised at a line of code below them. Is this because VB is interpreted at "Run" rather than Build.
Also as said before and can be seen in this code (as it has been gradually butchered) I have tried using "As New" and putting the clase name there thinking it may be an object problem. Doesn't work