Open Visual Studio.Net and create a new class library project, which we shall call "phpclas". Click OK.
In the code window for class1 (class1.vb), type the following:
Namespace HealthRecord
Public Class patient
Private m_lmp As Date
Public Property lmp()
Get
Return Format(m_lmp, "D")
End Get
Set(ByVal Value)
m_lmp = Value
End Set
End Property
Public ReadOnly Property edd()
Get
'EDD is 280 days from LMP
Return Format(DateAdd(DateInterval.Day, 280, m_lmp), "D")
End Get
End Property
End Class
End Namespace
This VB.NET code shall calculate the EDD (Estimated Delivery Date) from the specified LMP (Last Menstrual Period) date for any patient, to implement this we have created a namespace HealthRecord and a public class patient with two public property lmp and edd, edd is a readonly property, which is calculated from lmp which could be set and also read.
We have used format function to format the date variable to human readable format; also we have used dateadd function to calculate the edd, which is 280 days from the lmp.