Click here to Skip to main content
14,212,594 members
Rate this:
Please Sign up or sign in to vote.
See more:
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
Posted
Updated 3-Mar-12 7:59am
v10
Comments
Mahmud Hasan 3-Mar-12 14:00pm
   
Question Edited for formatting.
Rate this:
Please Sign up or sign in to vote.

Solution 1

The type name is System.DateTime. Use this full type name or add Import System.

—SA
   
Comments
Techhi 3-Mar-12 14:10pm
   
Thank You added Import.System and it got that error off but it gave me the :


'Set' parameter must have the same type as the containing property error.

For this :

[code]
Public Property AcquiredDate As DateTime
Get
Return m_DateTime
End Get
Set(ByVal value)
m_DateTime = Value
End Set
End Property

[/code]
   
You should have a member (a private field)
private m_DateTime as System.DateTime
to make it working.

Your setter is working with value parameter. Its type is defined by the type of the property. It is System.DateTime, so m_DateTime should be a field of exact same type.

When you finally get it, consider accepting this answer formally (green button) -- thanks.
--SA
Rate this:
Please Sign up or sign in to vote.

Solution 2

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 import System namespace.

Then,

Public Property DateTime
   Get
      Return m_DateTime
   End Get
   Set(ByVal value)
      m_DateTime = Value
   End Set
End Property


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
   
v4
Comments
Techhi 3-Mar-12 14:10pm
   
Thank You added Import.System and it got that error off but it gave me the :


'Set' parameter must have the same type as the containing property

error.

For this :

[code]
Public Property AcquiredDate As DateTime
Get
Return m_DateTime
End Get
Set(ByVal value)
m_DateTime = Value
End Set
End Property

[/code]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190619.2 | Last Updated 3 Mar 2012
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100