/ Forside/ Teknologi / Udvikling / VB/Basic / Spørgsmål
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
VB/Basic
#NavnPoint
berpox 2425
pete 1435
CADmageren 1251
gibson 1230
Phylock 887
gandalf 836
AntonV 790
strarup 750
Benjamin... 700
10  tom.kise 610
ReDim Preserve
Fra : kimhald
Vist : 155 gange
50 point
Dato : 05-10-06 20:40

Hej!

er der nogen der kan hjælpe mig dette problem
når jeg forsøger at udvide array får jeg run time error 9
subscript out of range

her er en lille testkørsel

Option Explicit
Option Base 1
Private Sub test()
Dim tmp() As Integer

ReDim tmp(1 To 1, 1 To 4)

ReDim Preserve tmp(1 To UBound(tmp) + 1, 1 To 4)
'code
ReDim Preserve tmp(1 To UBound(tmp) + 1, 1 To 4)

End Sub


mvh. Kim Hald

 
 
Kommentar
Fra : CADmageren


Dato : 06-10-06 08:46

Sakset fra hjælp
If you use the Preserve keyword, you can resize only the last array dimension and you can't change the number of dimensions at all. For example, if your array has only one dimension, you can resize that dimension because it is the last and only dimension. However, if your array has two or more dimensions, you can change the size of only the last dimension and still preserve the contents of the array. The following example shows how you can increase the size of the last dimension of a dynamic array without erasing any existing data contained in the array.

Du har altså kun mulighed for at ændre på den sidste parameter.

/Michael Christoffersen



Du har følgende muligheder
Dette spørgsmål er blevet annulleret, det er derfor ikke muligt for at tilføje flere kommentarer.
Søg
Reklame
Statistik
Spørgsmål : 177429
Tips : 31962
Nyheder : 719565
Indlæg : 6407948
Brugere : 218878

Månedens bedste
Årets bedste
Sidste års bedste