PrStudent

 

FrmOption

 

Public Class frmOption

Inherits System.Windows.Forms.Form

Dim progOption As Programming

Dim netOption As Network

Dim webOption As New Webmaster

Dim baseOption As New CISOption

Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click

If txtOption.Text = "Programming" Then

progOption = New Programming

txtOption.Text = progOption.Stuoption

txtGenEd.Text = progOption.GenEd

txtComputer3.Text = progOption.Computer3

txtOther3.Text = progOption.Other3

'txtComputer1.Text = progOption.Computer1

'txtOther1.Text = progOption.Other1

Else

If txtOption.Text = "Networking" Then

netOption = New Network

txtOption.Text = netOption.Stuoption

txtGenEd.Text = netOption.GenEd

txtComputer3.Text = netOption.Computer3

txtOther3.Text = netOption.Other3

'txtComputer1.Text = netOption.Computer1

'txtOther1.Text = netOption.Other1

Else

If txtOption.Text = "Webmaster" Then

'webOption = New Webmaster

txtOption.Text = webOption.Stuoption

txtGenEd.Text = webOption.GenEd

txtComputer3.Text = webOption.Computer3

txtOther3.Text = webOption.Other3

'txtComputer1.Text = webOption.Computer1

'txtOther1.Text = webOption.Other1

Else

txtOption.Text = "Invalid"

End If

End If

End If

txtComputer1.Text = baseOption.Computer1

txtOther1.Text = baseOption.Other1

 

End Sub

End Class

 

CISOption

 

Public Class CISOption

'memory variables associated with CISoptions

Private m_gened As Integer

Private m_computer3 As Integer

Private m_other3 As Integer

Private m_computer1 As Integer

Private m_other1 As Integer

Public Sub New()

m_gened = 8

m_computer3 = 10

m_other3 = 2

m_computer1 = 1

m_other1 = 1

End Sub

 

Public Property GenEd() As Integer

Get

Return m_gened

End Get

Set(ByVal Value As Integer)

m_gened = Value

End Set

End Property

Public Overridable Property Computer3() As Integer

Get

Return m_computer3

End Get

Set(ByVal Value As Integer)

m_computer3 = Value

End Set

End Property

Public Overridable Property Other3() As Integer

Get

Return m_other3

End Get

Set(ByVal Value As Integer)

m_other3 = Value

End Set

End Property

Public Property Computer1() As Integer

Get

Return m_computer1

End Get

Set(ByVal Value As Integer)

m_computer1 = Value

End Set

End Property

Public Property Other1() As Integer

Get

Return m_other1

End Get

Set(ByVal Value As Integer)

m_other1 = Value

End Set

End Property

End Class

 

Programming

 

Public Class Programming

Inherits CISOption

Private m_CISoption As String

 

Public Sub New()

m_CISoption = "Programming"

End Sub

Public Property Stuoption() As String

Get

Return m_CISoption

End Get

Set(ByVal Value As String)

m_CISoption = Value

End Set

End Property

End Class

 

Network

 

Public Class Network

Inherits CISOption

Private m_CISoption As String

Private m_computer3 As Integer

Private m_other3 As Integer

Public Sub New()

m_CISoption = "Networking"

m_computer3 = 12

m_other3 = 0

End Sub

Public Property Stuoption() As String

Get

Return m_CISoption

End Get

Set(ByVal Value As String)

m_CISoption = Value

End Set

End Property

Public Overrides Property Computer3() As Integer

Get

Return m_computer3

End Get

Set(ByVal Value As Integer)

m_computer3 = Value

End Set

End Property

Public Overrides Property Other3() As Integer

Get

Return m_other3

End Get

Set(ByVal Value As Integer)

m_other3 = Value

End Set

End Property

End Class

 

Webmaster

 

Public Class Webmaster

Inherits CISOption

Private m_CISoption As String

Private m_computer3 As Integer

Private m_other3 As Integer

 

Public Sub New()

m_CISoption = "Webmaster"

m_computer3 = 11

m_other3 = 1

End Sub

Public Property Stuoption() As String

Get

Return m_CISoption

End Get

Set(ByVal Value As String)

m_CISoption = Value

End Set

End Property

Public Overrides Property Computer3() As Integer

Get

Return m_computer3

End Get

Set(ByVal Value As Integer)

m_computer3 = Value

End Set

End Property

Public Overrides Property Other3() As Integer

Get

Return m_other3

End Get

Set(ByVal Value As Integer)

m_other3 = Value

End Set

End Property

End Class

 

Another version of frmOption

 

Public Class frmOption

Inherits System.Windows.Forms.Form

Dim progOption As Programming

Dim netOption As Network

Dim webOption As Webmaster

 

Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click

Dim CISOption As Object

Select Case txtOption.Text

Case "Programming"

CISOption = New Programming

Case "Networking"

CISOption = New Network

Case "Webmaster"

CISOption = New Webmaster

Case Else

txtOption.Text = "Invalid"

Exit Sub

End Select

txtOption.Text = CISOption.Stuoption

txtGenEd.Text = CISOption.GenEd

txtComputer3.Text = CISOption.Computer3

txtOther3.Text = CISOption.Other3

txtComputer1.Text = CISOption.Computer1

txtOther1.Text = CISOption.Other1

End Sub

End Class

 

PhoneLog2a

 

frmPhoneLog

 

Option Explicit On

 

Public Class frmPhoneLog

Inherits System.Windows.Forms.Form

Private _PhoneCall As PhoneCall

Private pc As New Object

Private _PhoneCalls As New PhoneCalls

Dim s_LogNo As Integer

 

Private Sub btnLog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLog.Click

If txtCaller.Text <> "" Then

txtTimeCall.Enabled = True

txtTimeCall.Text = CStr(Date.Now)

_PhoneCall = _PhoneCalls.Add(CDate(txtTimeCall.Text), txtCaller.Text, txtSubject.Text)

txtLogNo.Enabled = True

txtLogNo.Text = _PhoneCall.LogNo

txtLogNo.Enabled = False

txtTimeCall.Enabled = False

txtCaller.Enabled = False

txtSubject.Enabled = False

btnNewCall.Focus()

Else

txtCaller.Focus()

End If

End Sub

 

Private Sub btnNewCall_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNewCall.Click

txtLogNo.Enabled = True

txtLogNo.Text = ""

txtLogNo.Enabled = False

txtTimeCall.Enabled = True

txtTimeCall.Text = ""

txtTimeCall.Enabled = False

txtCaller.Enabled = True

txtCaller.Text = ""

txtSubject.Enabled = True

txtSubject.Text = ""

txtCaller.Focus()

End Sub

 

Private Sub btnListCalls_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnListCalls.Click

lstCalls.Items.Clear()

For Each _PhoneCall In _PhoneCalls

Dim phoneline As String

phoneline = CStr(_PhoneCall.LogNo) & " " _

& CStr(_PhoneCall.CallTime) & " " _

& _PhoneCall.Caller & " " _

& _PhoneCall.Subject

lstCalls.Items.Add(phoneline)

lstCalls.Refresh()

Next _PhoneCall

btnNewCall.Focus()

End Sub

 

Private Sub btnRetrieve_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRetrieve.Click

Dim strLogNo As String

strLogNo = InputBox("Enter Log # of call to be retriveved")

Try

_PhoneCall = _PhoneCalls.Item(CInt(strLogNo))

Catch

Dim ErrMsg As String

ErrMsg = CStr(Err.Number) & " " & Err.Source & " " & Err.Description

MsgBox(ErrMsg)

End Try

txtLogNo.Enabled = True

txtLogNo.Text = _PhoneCall.LogNo

txtLogNo.Enabled = False

txtTimeCall.Enabled = True

txtTimeCall.Text = _PhoneCall.CallTime

txtTimeCall.Enabled = False

txtCaller.Enabled = True

txtCaller.Text = _PhoneCall.Caller

txtCaller.Enabled = False

txtSubject.Enabled = True

txtSubject.Text = _PhoneCall.Subject

txtSubject.Enabled = False

 

End Sub

End Class

 

PhoneCall

 

Public Class PhoneCall

Public name As String

Private m_LogNo As Integer

Private m_LogTime As DateTime

Private m_CallTime As DateTime

Private m_Caller As String

Private m_Subject As String

 

Public Sub New(ByVal s_LogNo As Integer)

m_LogNo = s_LogNo

m_LogTime = Date.Now

End Sub

 

Public ReadOnly Property LogNo() As Integer

Get

Return m_LogNo

End Get

End Property

 

Public ReadOnly Property LogTime() As DateTime

Get

Return m_LogTime

End Get

End Property

 

Public Property CallTime() As DateTime

Get

Return m_CallTime

End Get

Set(ByVal s_Calltime As DateTime)

m_CallTime = s_Calltime

End Set

End Property

 

Public Property Caller() As String

Get

Return m_Caller

End Get

Set(ByVal s_Caller As String)

m_Caller = s_Caller

End Set

End Property

 

Public Property Subject() As String

Get

Return m_Subject

End Get

Set(ByVal s_Subject As String)

m_Subject = s_Subject

End Set

End Property

 

Protected Overrides Sub Finalize()

MyBase.Finalize()

End Sub

End Class

 

PhoneCalls

 

ublic Class PhoneCalls

Inherits System.Collections.CollectionBase

 

Public Function Add(ByVal v_CallTime As DateTime, ByVal v_Caller As String, ByVal v_Subject As String) As PhoneCall

Dim NewPhoneCall As New PhoneCall(list.Count)

With NewPhoneCall

.Caller = v_Caller

.Subject = v_Subject

.CallTime = v_CallTime

End With

list.Add(NewPhoneCall)

Return NewPhoneCall

End Function

 

Default Public ReadOnly Property Item(ByVal index As Integer) As PhoneCall

Get

Return CType(List.Item(index), PhoneCall)

End Get

End Property

 

End Class