ReDim of a variable of a custom type
Johnny Rosenberg <[email protected]> Mon, 15 Aug 2011 12:45:06 +0200
| Newsgroups | gmane.comp.openoffice.devel.api |
|---|---|
| Message-ID | <CADo7T4f+EvGZ3X3tvfBmQQuvbCm6fzrSWa+gqpR7mOUvgG9sHQ@mail.gmail.com> |
I wrote some example code: REM ***** BASIC ***** Option Compatible Option Explicit Type MyType a As Integer b As Integer End Type Dim x(1) As MyType Sub Main Dim y As MyType Dim i As Integer For i=0 To 1 x(i).a=1+i*2 x(i).b=2+i*2 Next i y.a=5 y.b=6 MsgBox x(0).a & x(0).b & x(1).a & x(1).b & y.a & y.b ' Displays 123456 ReDim x(1) As MyType ReDim y As MyType MsgBox x(0).a & x(0).b & x(1).a & x(1).b & y.a & y.b ' Displays 123400 End Sub So if we have an array as MyType (or any other custom type, I suppose), ReDim will not reset it. Is this the expected behaviour or should I write a bug report? -- ----------------------------------------------------------------- To unsubscribe send email to [email protected] For additional commands send email to [email protected] with Subject: help