Published in: Visual Basic
(VB6) Will push a given value to a given array.
Public Sub array_push(ArrayName() As String, Element As String) ' Make Sure The Variable Passed Is An Array If IsArray(ArrayName) = False Then Exit Sub ' If We Get An Error Here, it's Probably Because the Array ' is dimensioned with no values set, so just make the first element On Error GoTo make_it ' Allocate A New Array Slot ReDim Preserve ArrayName(UBound(ArrayName()) + 1) ' Set The Value Of The New Array Indice To Element ArrayName(UBound(ArrayName())) = Element Exit Sub make_it: ' Code Will Only Jump Here "on error" ReDim ArrayName(0) ArrayName(0) = Element End Sub
You need to login to post a comment.
