Can someone tell me what is wrong with this and how it is defined. I need to identify those areas that are incorrect and indicate what I need to do to fix it. It has to do something with basic class definitions, please help...
Public Class _MyClass
Private MyName As String
Private MyAddress As String
Public MyCity As String
Private Property GetName()
Get
Return MyName
End Get
Set(ByVal Value)
Value = MyName
End Set
End Property
Public Property MyAddress()
Get
Return MyAddress
End Get
Set(ByVal Value)
MyAddress = Value
End Set
End Property
Public ReadOnly Property GetCity()
Get
Return GetCity
End Get
End Property
Public Function CheckZipCode() As Boolean
If IsNumeric(MyZipCode) = False Then
Return False
Else
Return True
End If
End Function
Private Sub CapitalizeNames()
MyName = MyName.ToUpper
End Sub
End Class
besides kinger's suggestions:
1) Public Class _MyClass is not a CLS compliant name for a Class. you should remove the underscore (_)
2) in the SET part of the properties, you should identify the data type for the value passed to it.
for example in your code says:
Public Property MyAddress()
Get
Return MyAddress
End Get
Set(ByVal Value)
MyAddress = Value
End Set
End Property
on the Set part, it should be
Set(ByVal Value as String)
MyAddress = Value
End Set
same for every other property.