In picture A, use array. Hope is 1, the length of the length, in picture B, use the array. The length of the length hope is 3.
Idea is that in picture click switch processing, amend the data length is 1, but the content or the three elements in the array,
Switch to another, in the length changed to 3.
(now the code length to do a lot of use to judge, if every place changes, too unwieldy,)
CodePudding user response:
Use a function instead of directly using the length;For example:
The function GetLength (byref arr () as the Variant) as an integer
The if... Then
GetLength=1
The else
GetLength=3
End the if
End the function
When using this:
.=GetLength (Arr) 'is used to replace the Arr. Length;
CodePudding user response:
Study the ReDim PreserveCodePudding user response:
The topic and the Lord said is VB.net,In fact, several different way
1, use the redim preserve (don't know whether vb.net inside this writing), but the length 1 3 no problem data is not lost, 3 get 1 must have a data loss!
2, with two variables:
3, is the length of the three, the program code to determine the scene according to the scene to take a few Numbers, for example, define a variable, myArrLength, change scene when are you going to change the array length changing myArrLength=1 or myArrLength=3, then the code to replace the Arr. MyArrLength length