Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to clear dynamic array

Status
Not open for further replies.

andypower

Programmer
Aug 10, 2004
23
0
0
IN
i m developing one application in vb 6.
i used one dynamic array to stored data.to store data i used Redim and Preserve. but after one use i want to use same array in same procedure for other purpose for that i want to clear that array i. i dont want to change its no of columns but i want set its row=0
e.g. suppose while storing last record in array , the array size was 5 column and 25 rows now i want to use same array for different purpose but at that time it should have same column no but rows should be zero. for that i Redim it with 0 rows but it just clear data in array and keep row as it it i.e 25 and when i m going to insert new record in it it stores it at 26 row position. so what should i do plz help me and i cant use another array i need to use same array
 
Code:
    Dim a()
    ReDim Preserve a(1)
    a(0) = 1
    a(1) = 2[b]
    ReDim a(0)]/b]
    MsgBox a(0)

Skip,
[sub]
[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue][/sub]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top