|
-
Dec 30th, 2000, 11:27 AM
#1
Thread Starter
Member
I would like it so that every time a cmd button is pushed, whatever is in the textbox is automatically added to the array, in to the next available spot. Does anyone know how this would be done?
Thanks
cram
[email protected]
_ _ _ _ _ _ _ _ _ _ _ _ _ _
Things to Ponder

|Man who stands on toilet,
Is high On pot|
|Baseball Wrong,
Man with four balls cannot walk|
-
Dec 30th, 2000, 11:54 AM
#2
Fanatic Member
This should work....
Code:
Option Explicit
Dim sArray() As String ' declare dynamic array
Private Sub Command1_Click()
On Error Resume Next ' call to UBound raises error number 9 if it has not been dimensioned yet
Dim iCt As Integer
If Not Trim(Text1.Text) = "" Then ' assure user input something
iCt = UBound(sArray) + 1 ' get new number of array elements
ReDim Preserve sArray(iCt) ' Change the dimensions of the array
sArray(iCt) = Text1.Text ' add current text to the array
End If
End Sub
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Dec 30th, 2000, 04:33 PM
#3
Thread Starter
Member
Can you tell me why, when I do this, It complains to me, array already dimensioned?
Thanks
cram
[email protected]
_ _ _ _ _ _ _ _ _ _ _ _ _ _
Things to Ponder

|Man who stands on toilet,
Is high On pot|
|Baseball Wrong,
Man with four balls cannot walk|
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|