Roger Whiteley
New Member
- Joined
- Jun 11, 2009
- Messages
- 34
I have a number of arrays of controls in my code for a form, and when trying to redimension them to add additional controls I am getting a subscript out of range error when I try to increase the second dimension of a two dimensional array.
The arrays all contain controls which are built up on a form, the number of rows which is dependent on the amount of data for any enquiry
The original declaration is:
Before use the array is redimmed as follows:
Where iNf Years represents the number of years which is constant for the processing run, and colPOSITIONS.Count is the size of a collection returned from a User Interface Support Layer.
The initial build up of the controls on the form works perfectly, but when I try to add an extra row of data I get the "subscript out of range error" on the highlighted line below.
The one dimensional arrays expand correctly, at least up to the error.
Has anybody got any ideas?
The arrays all contain controls which are built up on a form, the number of rows which is dependent on the amount of data for any enquiry
The original declaration is:
Code:
Public gatxtWTE() As Control
Before use the array is redimmed as follows:
Code:
ReDim gatxtWTE(1 To iNO_of_YEARS, colPOSITIONS.Count)
Where iNf Years represents the number of years which is constant for the processing run, and colPOSITIONS.Count is the size of a collection returned from a User Interface Support Layer.
The initial build up of the controls on the form works perfectly, but when I try to add an extra row of data I get the "subscript out of range error" on the highlighted line below.
Code:
ReDim Preserve galblPOSITIONS(1 To UBound(galblPOSITIONS, 1) + 1)
ReDim Preserve galblDESCRIPTIONS(1 To UBound(galblDESCRIPTIONS, 1) + 1)
ReDim Preserve galblWTE(1 To UBound(galblWTE, 1) + 1)
ReDim Preserve galblNO_OF_EMPLOYEES(1 To UBound(galblNO_OF_EMPLOYEES, 1) + 1)
[B][U] ReDim Preserve gatxtWTE(1 To iNO_of_YEARS, 1 To UBound(gatxtWTE, 2) + 1)[/U][/B]
ReDim Preserve maLABELS(1 To UBound(maLABELS, 1) + 4)
ReDim Preserve maTEXT_BOXES(1 To UBound(maTEXT_BOXES, 1) + iNO_of_YEARS)
The one dimensional arrays expand correctly, at least up to the error.
Has anybody got any ideas?