002
23.12.2004, 16:59 Uhr
irminsul
|
hi,
also strings konnte ich schon zusammefügen ... und string ist NICHT gleich array !! aber ich hab da inzwischen was gefunden ...
Code: |
Dim arra_b Dim arra_c
Private Sub Command1_Click() Text1.Text = "" For i = 0 To UBound(arra_c) Text1.Text = Text1.Text & arra_c(i) & ", " Next Text1.Text = Text1.Text + " || " For i = 0 To UBound(arra_b) arra_c = AddElement(arra_c, arra_b(i)) Next i For i = 0 To UBound(arra_c) Text1.Text = Text1.Text & arra_c(i) & ", " Next End Sub
Private Sub Form_Load() arra_c = Array(10, 11, 12, 13, 14, 15) arra_b = Array(22, 33, 44, 55, 66, 77) End Sub
Public Function AddElement(vArray As Variant, vElem As Variant) As Variant ' This function adds an element to a Variant array ' and returns an array with the element added to it. Dim vRet As Variant ' To be returned If IsEmpty(vArray) Then ' First time through, create an array of size 1. vRet = Array(vElem) Else vRet = vArray ' From then on, ReDim Preserve will work. ReDim Preserve vRet(UBound(vArray) + 1) vRet(UBound(vRet)) = vElem End If AddElement = vRet End Function
|
die AddElement-Function ist aus der MSDN, aus dem abschnitt "advanced MSVB 5" |