Thread: Checking Arrays

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    47
    Rep Power
    11

    Checking Arrays


    I have
    testArray: Array[0..10] of String;
    testButton: TButton;
    saveButton: TButton;

    the first time i click the button i want to see all the elements of the array.
    When i click the save button i want to save the amended array.

    The first time i click the testButton i get an error because nothing is in the array yet (on debug the array show inaccessible value). how do i check the array to see if anythings in it????

    I dont have a problem with showing or saving the array.

    hope you understand what i trying to say
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,616
    Rep Power
    4247
    1. Declare a boolean variable for your class (say bInitialized)
    2. On FormCreate(), set bInitialized := false;
    3. When the array is initialized, set bInitialized := true;
    4. Check the value of bInitialized before accessing the array elements.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo