PHPBuilder - Using .NET Assembly (Interoperability with COM) Page 2



RSS Twitter
Articles Php Functions

Using .NET Assembly (Interoperability with COM) - Page 2

by: Jayesh Jain
|
November 5, 2002

Creating a Assembly
Open Visual Studio.Net and create a new class library project, which we shall call "phpclas". Click OK.
New Project window
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.

« Previous Page
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Jayesh Jain

Comment:



Comment:

(Maximum characters: 1200). You have characters left.