未找到类型'clsBook'上的公共成员'作者'。为什么?

时间:2011-10-16 09:38:48

标签: vb.net visual-studio-2010

Private Sub ShowCurrentRecord()

    txtBookID.Text = books(index).BookID        
    txtAuthor.Text = books(index).Author        
    txtTitle.Text = books(index).Title        
    txtPurchasePrice.Text = books(index).PurchasePrice        
    txtSalePrice.Text = books(index).SalePrice        
    txtInventory.Text = books(index).Inventory

找不到“clsBook”类型的公共成员“作者”。

这是我在课堂上使用的代码......

Public Property AuthorID() As String

        Get    
            Return bookAuthor    
        End Get

        Set(ByVal value As String)   
            bookAuthor = value    
        End Set

End Property

仍然,它不起作用。 T.T

1 个答案:

答案 0 :(得分:3)

这意味着错误说的是什么。您的Author课程中没有名为clsBook的公共媒体资源。您正尝试在第二行访问此属性;因此,编译器正在抱怨。

尝试将属性添加到类中;或删除使用它的声明;它会编译。

响应您的更新:当您尝试访问AuthorID(名称末尾没有ID)时,您的类中的属性被命名为Author(ID最后)。< / p>

相关问题