将C#转换为VB.NET [英] Converted C # to VB.NET
本文介绍了将C#转换为VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请有人告诉我这个错误可能意味着什么:
Type ''DateTime is not defined. Line 94
Please can someone tell me what this error possibly means :
Type ''DateTime is not defined. Line 94
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.IO
Imports System.Data
Imports System.ComponentModel.DataAnnotations
Namespace UsedCarsSales
Public Class Sales
Public Property VehicleID() As Integer
Get
Return m_VehicleID
End Get
Set
m_VehicleID = Value
End Set
End Property
Private m_VehicleID As Integer
Public Property Manufacturer() As String
Get
Return m_Manufacturer
End Get
Set
m_Manufacturer = Value
End Set
End Property
Private m_Manufacturer As String
Public Property Make() As String
Get
Return m_Make
End Get
Set
m_Make = Value
End Set
End Property
Private m_Make As String
Public Property Model() As String
Get
Return m_Model
End Get
Set
m_Model = Value
End Set
End Property
Private m_Model As String
Public Property Year() As String
Get
Return m_Year
End Get
Set
m_Year = Value
End Set
End Property
Private m_Year As String
Public Property Color() As String
Get
Return m_Color
End Get
Set
m_Color = Value
End Set
End Property
Private m_Color As String
Public Property DateTime
Get
Return m_DateTime
End Get
Set(ByVal value)
m_DateTime = Value
End Set
End Property
Private m_DateTime
Public Property AcquisitionCost() As Decimal
Get
Return m_AcquisitionCost
End Get
Set
m_AcquisitionCost = Value
End Set
End Property
Private m_AcquisitionCost As Decimal
Public Property MaintenanceCost() As Decimal
Get
Return m_MaintenanceCost
End Get
Set
m_MaintenanceCost = Value
End Set
End Property
Private m_MaintenanceCost As Decimal
Public Property DateSold() As DateTime
Get
Return m_DateSold
End Get
Set
m_DateSold = Value
End Set
End Property
Private m_DateSold As DateTime
Public Property OdometerReading() As Integer
Get
Return m_OdometerReading
End Get
Set
m_OdometerReading = Value
End Set
End Property
Private m_OdometerReading As Integer
Public Property SellingPrice() As Decimal
Get
Return m_SellingPrice
End Get
Set
m_SellingPrice = Value
End Set
End Property
Private m_SellingPrice As Decimal
Public Property SalesRepID() As Integer
Get
Return m_SalesRepID
End Get
Set
m_SalesRepID = Value
End Set
End Property
Private m_SalesRepID As Integer
Public Property SalesRep() As SalesRep
Get
Return m_SalesRep
End Get
Set
m_SalesRep = Value
End Set
End Property
Private m_SalesRep As SalesRep
End Class
End Namespace
推荐答案
类型名称为System.DateTime
.使用此完整类型名称或添加Import System
.
—SA
The type name isSystem.DateTime
. Use this full type name or addImport System
.
—SA
您的代码有点可读性.请在其上应用适当的样式,以使其读起来更好.
似乎问题出在这里:
首先导入System
命名空间.
然后,
Your code is a bit un-readble. Please apply proper style on it so that it reads better.
It seems problem is here:
First of all importSystem
namespace.
Then,
Public Property DateTime
Get
Return m_DateTime
End Get
Set(ByVal value)
m_DateTime = Value
End Set
End Property
该属性未定义类型. DateTime是.net中的一种类型.因此,属性的名称应该有所不同,您需要告诉您属性的类型.例如:
The property has no type defined. DateTime is a type in .net. So the name of the property should have been something different and you need tell the type of your property. For example:
Public Property MinDateTime as DateTime
Get
Return m_DateTime
End Get
Set(ByVal value)
m_DateTime = Value
End Set
End Property
这篇关于将C#转换为VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文