1
我有這個錯誤在我的vb.net剃鬚刀2代碼「對象變量或塊變量未設置」。 11錯誤在每個循環vb.net剃鬚刀2(ASP.NET網頁)
Line 9: Dim i = 0
Line 10:
Line 11: @For Each color In PageData("Colors")
Line 12: @<p style="background-color:@color; font-family:@Page.Fonts(i)">
Line 13: This paragraph is @color
線這是我的_PageStart.vbhtml代碼:
@Code
Layout = "~/Shared/_Layout1.vbhtml"
PageData("Colors") = {"LightCyan", "Gainsboro", "Chocolate"}
End Code
這是我的default.vbhtml代碼:
@Code
Page.Title = "Level 1 Start page"
Layout = "~/Shared/_Layout2.vbhtml"
End Code
<h1>Testing _PageStart From Level 1</h1>
@Code
Dim i = 0
@For Each color In PageData("Colors")
@<p style="background-color:@color; font-family:@Page.Fonts(i)">
This paragraph is @color
</p>
i += 1
Next
End Code
<p><a href="/Level1/Page">Click</a> to visit Level 1</p>