i created a component to validate a card number. it is a simple component which tells "A card no. has to be 16digits long for it to be a valid card number."
the code is as follows.
Public Class CardValidator
Inherits System.ComponentModel.Component
#Region " Component Designer generated code "
Public Sub New(Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(me)
End Sub
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Component overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
#End Region
'declaring two variables to store the name and card numbers
Private name As String
Private CardNo As String
'property declarations
Public Property CustomerName() As String
Get
Return name
End Get
Set(ByVal CustName As String)
name = CustName
End Set
End Property
Public Property CardNumber() As String
Get
Return CardNo
End Get
Set(ByVal Number As String)
CardNo = Number
End Set
End Property
Public Function validate() As Integer
Dim cardlength As Integer = 0
cardlength = CardNo.Length
Dim validLuhn As Boolean
If cardlength = 16 Then
Return True
Else
Return False
End If
End Function
End Class
plz explain what "Public Property CustomerName() As String" stands for ...
i wud be grateful if u cud explain what the get() and set() methods do!!!
Return name .... where is the name returned ??
the code is as follows.
Public Class CardValidator
Inherits System.ComponentModel.Component
#Region " Component Designer generated code "
Public Sub New(Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(me)
End Sub
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Component overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
#End Region
'declaring two variables to store the name and card numbers
Private name As String
Private CardNo As String
'property declarations
Public Property CustomerName() As String
Get
Return name
End Get
Set(ByVal CustName As String)
name = CustName
End Set
End Property
Public Property CardNumber() As String
Get
Return CardNo
End Get
Set(ByVal Number As String)
CardNo = Number
End Set
End Property
Public Function validate() As Integer
Dim cardlength As Integer = 0
cardlength = CardNo.Length
Dim validLuhn As Boolean
If cardlength = 16 Then
Return True
Else
Return False
End If
End Function
End Class
plz explain what "Public Property CustomerName() As String" stands for ...
i wud be grateful if u cud explain what the get() and set() methods do!!!
Return name .... where is the name returned ??