Hvad går der galt? arraylist.capacity
Hvad går der galt ?Jeg er ny i vb.net, men mener at aMatch.Capacity retunerer længden af arrayet !!?
Jeg får fejlen:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information: Index was out of range. Must be non-negative and less than the size of the collection.
Koden:
Dim rRegEx As Regex
Dim mMatch As Match
Dim aMatch As New ArrayList()
Dim nr As Integer
rRegEx = New Regex("img.*src\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))", RegexOptions.IgnoreCase Or RegexOptions.Compiled)
mMatch = rRegEx.Match(strHTML)
While mMatch.Success
Dim sMatch As String
sMatch = mMatch.Groups(1).ToString
aMatch.Add(sMatch)
mMatch = mMatch.NextMatch()
End While
For n = 0 To aMatch.Capacity
ListBox1.Items.Add(aMatch(n))
Next
