Results 1 to 11 of 11

Thread: Clearing Arrays

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    9

    Exclamation Clearing Arrays

    I need some help clearing my arrays. The button I have it coded under is on a main form, seperate of the form with the array.

    My array is named sArrTicket.

    I have it and all my other main arrays that I have to clear declared in a module.

    I'm not the worlds greatest at VB.NET , so please be easy on me.

    Thanks guys.

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    In .NET?

    Array.Clear(sArrTicket,0,sArrTicket.Length-1)

    I think.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    9
    yeah..in NET

    that code isn't working on my click event, though.

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Well, I'm very well versed in .NET, I just pulled that out of help.

    Sorry.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    9
    I sure wish it would work, though.

    This array business is simply beating me over the back of the head.

    I also need to pull my array info onto another label on another form seperate of its original form.

    Why oh why can't i get a break

  6. #6
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    arrayname = nothing

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    9
    oh, my teacher mentioned something of putting the counter back to 0 or doing something in the loop....

    ok, thas probably way too vague.

    setting my array = 0 will empty out the array info?

  8. #8
    Hyperactive Member
    Join Date
    Dec 2000
    Posts
    462
    Try using erase Array name


    LIke:

    Erase sArrTicket

    This will clear all data.

    Here is a example:

    VB Code:
    1. ' Declare array variables.
    2. Dim NumArray(10) As Integer   ' Integer array.
    3. Dim StrVarArray(10) As String   ' Variable-string array.
    4. Dim StrFixArray(10) As String * 10   ' Fixed-string array.
    5. Dim VarArray(10) As Variant   ' Variant array.
    6. Dim DynamicArray() As Integer   ' Dynamic array.
    7. ReDim DynamicArray(10)   ' Allocate storage space.
    8. Erase NumArray   ' Each element set to 0.
    9. Erase StrVarArray   ' Each element set to zero-length
    10.    ' string ("").  
    11. Erase StrFixArray   ' Each element set to 0.
    12. Erase VarArray   ' Each element set to Empty.
    13. Erase DynamicArray   ' Free memory used by array.
    Last edited by Dbee; Nov 14th, 2002 at 07:11 PM.
    Don
    (OLD DOS Programmer)

  9. #9

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    9
    Originally posted by Dbee
    Try using erase Array name


    LIke:

    Erase sArrTicket

    This will clear all data.

    Here is a example:

    VB Code:
    1. ' Declare array variables.
    2. Dim NumArray(10) As Integer   ' Integer array.
    3. Dim StrVarArray(10) As String   ' Variable-string array.
    4. Dim StrFixArray(10) As String * 10   ' Fixed-string array.
    5. Dim VarArray(10) As Variant   ' Variant array.
    6. Dim DynamicArray() As Integer   ' Dynamic array.
    7. ReDim DynamicArray(10)   ' Allocate storage space.
    8. Erase NumArray   ' Each element set to 0.
    9. Erase StrVarArray   ' Each element set to zero-length
    10.    ' string ("").  
    11. Erase StrFixArray   ' Each element set to 0.
    12. Erase VarArray   ' Each element set to Empty.
    13. Erase DynamicArray   ' Free memory used by array.
    i have my array publicly declared and have tried the Erase arrayname on my click event on another form. This hasn't worked, though?

  10. #10

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    9
    got some help from someone in my class...thought i'd share when erase and other methods just weren't working.

    aArrticket(20) = 0

    then i just have to clear out the display labels. man..stare at this stuff long enough and you can't even figure out the easy stuff. i'm a dork.

    thank you so much for your help, guys..its very clear ya'll are quite well versed.

  11. #11
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228
    VB Code:
    1. Redim MyArrayHere(0)
    2. MyArrayHere = vbNull
    Luke

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