Rs.Close Set Rs = Nothing Conn.Close Set Conn = Nothing
Function FindProfileNr(id) For FP = 0 to 255 If FP = id then strFP = FP Stop End If Next FindProfileNr = strFP End Function
if FindProfileNr(rs("id")) = 1 then strForrige = UBound(arrFriendViewByProfile) else strForrige = arrFriendViewByProfile( int( FindProfileNr(rs("id")) - 1 ) ) End If
if FindProfileNr(rs("id")) = UBound(arrFriendViewByProfile) then strNext = 1 else strNext = arrFriendViewByProfile( int( FindProfileNr(rs("id")) + 1 ) ) End If
Ja det ville det, men i stedet for 255 bør man bruge ubound(arrayet)
Function FindProfileNr(id) For FP = 0 to ubound(arrFriendViewByProfile) If arrFriendViewByProfile(FP) = id then strFP = FP Stop End If Next FindProfileNr = strFP End Function
og så skal der også int omkring if sætningen inde i funktionen som tjekker mod id, så det bliver:
Function FindProfileNr(id) For FP = 0 to ubound(arrFriendViewByProfile) If int(arrFriendViewByProfile(FP)) = id then strFP = FP Stop End If Next FindProfileNr = strFP End Function
Function FindProfileNr(id) For FP = 0 to ubound(arrFriendViewByProfile) If int(arrFriendViewByProfile(FP)) = id then strFP = FP Stop End If Next FindProfileNr = strFP End Function
Vent.. det var denne her: if FindProfileNr(rs("id")) = 1 then strForrige = int(UBound(arrFriendViewByProfile)) +1 else strForrige = arrFriendViewByProfile( int( FindProfileNr(rs("id")) - 1 ) ) End If
Men da jeg sætte denne her ind: if FindProfileNr(rs("id")) = 1 then strForrige = int(UBound(arrFriendViewByProfile)) +1 elseif FindProfileNr(rs("id")) = 0 then strForrige = int(UBound(arrFriendViewByProfile)) +1 else strForrige = arrFriendViewByProfile( int( FindProfileNr(rs("id")) - 1 ) ) End If
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.