I'm confused as to how to do a for-each loop for an array of objects. Currently, my methods are getting me errors in one of two ways. Either the for loop executes, and runs into problems because it thinks the class variables are undefined, or it runs into the issue that the object type is an illegal assignment.
私が定義したクラスは次のとおりです。
Class url_Link
Public title, link
Public Default Function Init(newTitle, newLink)
title = newTitle
link = newLink
Set Init = Me
End Function
End Class
参考までに、私が得るエラーは次のとおりです。
Microsoft VBScript ランタイム エラー '800a01f5'
無効な割り当て: 'url_Link'
行 674
このコード スニペットを使用して:
<% for each x in systemSettingsArray%>
<tr>
<td class='nograph'><A href='<%x.link%>'><%x.title%></a></td>
</tr>
<%next%>
に変更url_Link
するとx
、次のエラーが発生します。
無効なプロシージャ コールまたは引数 "link"
オブジェクトを作成して配列に入力するコード:
Dim systemSettingsArray(1)
Dim link
Dim arrayCounter
arrayCounter = 0
Set systemSettingsArray(arrayCounter) = (New url_Link)("Account Administration", "Maintenance/Account_Admin.asp")
arrayCounter = arrayCounter + 1
Set systemSettingsArray(arrayCounter) = (New url_Link)("Time Approval", "Maintenance/system_Time_Approval.asp")