源代码清单

  • 格式:doc
  • 大小:115.50 KB
  • 文档页数:19

Code Document 1 诊所管理系统案例研究项目源代码清单

1. 工程prjClinic的标准模块:ModMain.Bas的代码如下:

Public cn As ADODB.Connection

Public Sub GetConnected()

Set cn = New ADODB.Connection

cn.Open "DSN=Clinic;uid=sa;pwd=passwd;"

End Sub

Public Sub main()

FrmLogin.Show

End Sub

2. ActiveX控件工程prjDocLogin的控件文档:docLogin.Ctl的代码如下:

'Event Declarations:

Event Click() 'MappingInfo=Command1,Command1,-1,Click

Private Sub cmdLogin_Click()

RaiseEvent Click

End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED

LINES!

'MappingInfo=txtDocID,txtDocID,-1,Text

Public Property Get DoctorID() As String

DoctorID = txtDocID.Text

End Property

Public Property Let DoctorID(ByVal New_DoctorID As String)

txtDocID.Text() = New_DoctorID

PropertyChanged "DoctorID"

End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED

LINES!

'MappingInfo=txtPassword,txtPassword,-1,Text

Public Property Get Password() As String

Password = txtPassword.Text

End Property

Public Property Let Password(ByVal New_Password As String)

txtPassword.Text() = New_Password

PropertyChanged "Password"

End Property Code Document 2

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED

LINES!

'MemberInfo=7

'Load property values from storage

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

txtDocID.Text = PropBag.ReadProperty("DoctorID", "")

txtPassword.Text = PropBag.ReadProperty("Password", "")

End Sub

'Write property values to storage

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

Call PropBag.WriteProperty("DoctorID", txtDocID.Text, "")

Call PropBag.WriteProperty("Password", txtPassword.Text, "")

End Sub

3. ActiveX控件工程prjChat的控件文档:ChatControl.Ctl的代码如下:

Private Sub ChatUDP_DataArrival(ByVal bytesTotal As Long)

Dim strData As String

Dim strrecd As String

ChatUDP.GetData strData

strrecd = txtRemoteHost.Text + ": " + strData

txtReceive.Text = txtReceive.Text + Chr(13) + Chr(10) + strrecd

End Sub

Private Sub cmdConnect_Click()

ChatUDP.RemoteHost = Trim(txtRemoteHost.Text)

ChatUDP.RemotePort = Val(txtRemotePort.Text)

ChatUDP.Bind Val(txtLocalPort.Text)

MsgBox "Connection Established"

txtSendData.Enabled = True

cmdSend.Enabled = True

txtRemotePort.Enabled = False

txtRemoteHost.Enabled = False

txtLocalPort.Enabled = False

cmdConnect.Enabled = False

End Sub

Private Sub cmdSend_Click()

Dim strsend As String

ChatUDP.SendData txtSendData.Text

strsend = ChatUDP.LocalHostName + ": " + txtSendData.Text

txtReceive.Text = txtReceive.Text + Chr(13) + Chr(10) + strsend Code Document 3 txtSendData.Text = ""

End Sub

Private Sub UserControl_Initialize()

txtSendData.Enabled = False

txtReceive.Enabled = True

cmdSend.Enabled = False

End Sub

'Load property values from storage

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

txtRemoteHost.Text = PropBag.ReadProperty("Host", "")

txtRemotePort.Text = PropBag.ReadProperty("Port", "")

txtLocalPort.Text = PropBag.ReadProperty("Bind", "")

End Sub

'Write property values to storage

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

Call PropBag.WriteProperty("Host", txtRemoteHost.Text, "")

Call PropBag.WriteProperty("Port", txtRemotePort.Text, "")

Call PropBag.WriteProperty("Bind", txtLocalPort.Text, "")

End Sub

4. ActiveX DLL组件工程prjBill的类模块:ClsBill.Cls的代码如下:

'local variable(s) to hold property value(s)

Private mvarDoctorPatientId As String 'local copy

Private mvarPatientId As String 'local copy

Private mvarDoctorId As String 'local copy

Private mvarReason As String 'local copy

Private mvarPrescriptionDetails As String 'local copy

Private mvarConsultationFees As String 'local copy

Private mvarBillDate As Date 'local copy

Private mvarMedicineId As String 'local copy

Private mvarModeOfPayment As String 'local copy

Public Property Let ModeOfPayment(ByVal vData As String)

'used when assigning a value to the property, on the left side of an assignment.

'Syntax: X.ModeOfPayment = 5

mvarModeOfPayment = vData

End Property

Public Property Get ModeOfPayment() As String

'used when retrieving value of a property, on the right side of an assignment.

'Syntax: Debug.Print X.ModeOfPayment

ModeOfPayment = mvarModeOfPayment

End Property

Public Property Let MedicineId(ByVal vData As String)