在我的表格中,我有以下...
if (productNo == this.product1.ProductNumber) //ProductNumber comes from Product class
{
//if so, set the other values of the text boxes to that of the
//product in memory
tbDescription.Text = product1.ProductDescription; //Works - from Product class
tbOnHand.Text = product1.NumberOnHand.ToString(); //Works - from Product class
tbUnitOfMeasure.Text = product1.UnitOfMeasure; //Works - from Product class
tbVendorID.Text = product1.VendorID; // Doesn't work - from derived ManufacturedProduct class
}
其中 VendorID 来自 ManufacturedProduct 类,该类是来自 Product 的派生类。最后一行代码是行不通的。我希望能够使用 product1.VendorID 中的值填充 tbVendorID(顺便说一下,它是一个 int)
我收到以下错误...Objects.Product 不包含“VendorID”的定义,并且找不到接受“Objects.Product”类型的第一个参数的扩展方法“VendorID”(您是否缺少 using 指令或装配参考?)