正在获取:“结构无法被索引,因为它没有默认属性”。我究竟做错了什么?我在做什么错误:结构无法被索引,因为它没有默认属性(WITH CLAUSE)
With grid.Rows(10).Cells
Dim note As New Note With {.ID = "Blah", _
.Date = "1/1/2011", _
.Message = "AAA", _
.Type = "ABC", _
.SubType = "DEF", _
.ReferenceKey = !SetRefNum.Value}
End With
,并注意样子:
Public Structure Note
Public Property ID As String
Public Property [Date] As Date
Public Property Message As String
Public Property Type As String
Public Property SubType As String
Public Property ReferenceKey As String
End Structure
我遗漏了我的一部分代码......你是对的,这是在“WITH”块中。我改变了原来的帖子。 – Denis
麻烦的是你有两个'With'块:有grid.Rows(10).Cells'和'With note'。请参阅经过编辑的建议答案 –
就是这样!谢谢 – Denis