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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Array size durring runtime 2

Status
Not open for further replies.

Japskunk72

Programmer
Feb 19, 2003
64
US
I want to be able to change the number of objects i have in an array based on how many fields i have in a table.

Module TBLInfo
Public PaStructTBLBackup(TBLBackupLocAMT) As structTBLBackLoc
Public Sub LoadDB()
Dim Amt As Integer
Dim X As Integer

DBConnect.Connect("Select * from TBLBackuploc")
Amt = RS.RecordCount
tblbackuplocAMT = AMT
For X = 1 To AMT
With PaStructTBLBackup(X)
.BackupLoc = RS.Fields "BackupToloc").Value
.FileName = RS.Fields("Filename").Value
End With
RS.MoveNext()
Next
RS.Close()
end sub
Public Structure structTBLBacloc
Dim BackLoc As String
Dim FileName As String
End Structure
End Module

is there a way to publicly declair an array and beable to change the array size durring the program?
Thanks
JT
 
redim is the word you are looking for and redim preserve to keep the values that were already there. but this isn't the ".net" way.

Lookup arralist and see that it is much better for what you want to do.

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
I would also suggest using an ArrayList over a regular array in this case.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top