Results 1 to 3 of 3

Thread: Having troubles putting information(strings) into an array

  1. #1

    Thread Starter
    Registered User struntz's Avatar
    Join Date
    Aug 1999
    Location
    Brockway,Pa,USA
    Posts
    199

    Question

    hello, i have been trying to figure out why this isn't working, first i tried and give the user a choice to enter how many "dimensions" they wish to have(well i said, enter amount of Cd Titles you wish to enter) well the THing is i'm trying to make is a simple app, that keeps track of cds u have...and so far i've been messing aroundand i can't find out what to do now....here is my code:
    [/code]
    Dim CdArray()
    Option Explicit

    Private Sub Command1_Click()
    Dim CdTitles


    Do
    CdTitles = InputBox("Enter Cd Titles")
    ReDim CdArray(1 To CdTitles)
    lst1.AddItem (CdTitles)
    Loop While CdTitles <> ""

    End Sub
    [/code]

    and it doesn't seem tow ork says, Type mismatch, can someoen plesae tell me what i'm doing wrong? thanks for listening!

  2. #2
    Guest

    A bit confusing but.,,......

    Originally posted by struntz
    Dim CdArray()
    Option Explicit

    Private Sub Command1_Click()
    Dim CdTitles


    Do
    CdTitles = InputBox("Enter Cd Titles")
    ReDim CdArray(1 To CdTitles)
    lst1.AddItem (CdTitles)
    Loop While CdTitles <> ""

    End Sub
    [/code]
    Maybe something like
    Code:
    Dim CdTitles As Integer
    Dim XX       As Integer
    Dim CdName   As String
    '
    CdTitles = InputBox("Enter Total Number of Cd Titles")
    ReDim CDArray(1 To CdTitles)
    For XX = 1 to CdTitles
       CdName = InputBox("Enter Name of Cd")
       if Len(Trim(CdName)) > 0 then
          CdArray(XX) = CdName
       Else
          Exit For
       End If
    Next XX
    [Edited by Jethro on 07-28-2000 at 01:08 AM]

  3. #3

    Thread Starter
    Registered User struntz's Avatar
    Join Date
    Aug 1999
    Location
    Brockway,Pa,USA
    Posts
    199

    THanks that did the trick!

    Hey Thanks Jethro, that did it!
    damn i hate it when i forget what to do, i was up all night studying array's off this, and i couldn't even do a simple thing like that!
    Thanks for helping though!
    Regads,


    Cory

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width