Sunteți pe pagina 1din 5

Rahman Malik

PROGRAM TWO: NOTE SAVER


SECTION ONE: ANALYSIS AND DESIGN

The purpose of this program is to allow students to take down their own notes while in class.
The form consists of a rich text box, three buttons and two labels. Below is a screenshot of
the layout of the form:

As you can see this is a basic form with three buttons, a rich text box and two labels. I will
now provide a screenshot of the properties of the form below:
Rahman Malik

Above are the properties of the form. I will now describe some of its properties in more detail and
explain what I have declared them as.
Rahman Malik

SECTION TWO: CODE AND IMPLEMETATION OF


APPLICATION

Below I will provide you with the actual program code then go on to discuss what variables were
declared and why:

Private Sub TMRMyTime_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles TMRMyTime.Tick
TheDate = DateAndTime.Today

TheTime = DateAndTime.TimeOfDay

lblDate.Text = TheDate

lblTime.Text = TheTime
End Sub

Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles cmdExit.Click
theResponse = MsgBox("do you want to quit?", MsgBoxStyle.Question +
vbYesNo, "Micks Note Saver")

If theResponse = vbYes Then

MsgBox("Goodbye", MsgBoxStyle.Exclamation, "Rahman`s Note Saver


2007")

Me.Close()

Else

MsgBox("Thanks", MsgBoxStyle.Exclamation, "Rahman`s Note Saver


2007")
End If

End Sub

Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles cmdSave1.Click cmdSave1.Click, cmdSave2.Click,
cmdSave3.Click,cmdSave4.Click, cmdSave5.Click, cmdSave6.Click

End Sub

Private Sub cmdOpen_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles cmdOpen.Click
If OFDNotes.ShowDialog = System.Windows.Forms.DialogResult.OK Then
Dim sr As New System.IO.StreamReader(OFDNotes.FileName)
MessageBox.Show(sr.ReadToEnd, "Rahman's Note Saver 2010")
End If
End Sub

Private Sub cmdSave1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles cmdSave1.Click
Dim savefile1 As New SaveFileDialog
Rahman Malik

savefile1.DefaultExt = "*.doc"
savefile1.Filter = "Btec Files| *.doc"
If (savefile1.ShowDialog = System.Windows.Forms.DialogResult.OK)
And (savefile1.FileName.Length) > 0 Then
Case cmdSave1.Name
RTBNote1.SaveFile(SaveFile1.FileName,
RichTextBoxStreamType.PlainText
End select
End If
End Sub
End Class

Above is the actual program code for my application and I will now explain what variables I have
declared:

Dim TheDate As DateTime 'Will assign and store the date & time
Dim TheTime As DateTime 'Will assign and store the date & time
Dim theResponse As String 'Stores the response from the quit message box

Above are the declared variables for my application. The reason these variables are declared is
because they are used to store values. These values will then be used throughout my code as can be
seen in my actual program code. Without these variables my code will then end up with errors and the
program not working.
Rahman Malik

SECTION THREE: TESTING

I will now represent a testing table and this to ensure that all my buttons etc do what they are
supposed to be doing. The testing table will consist of the following headings:

• Test
• Test Data Used
• Expected Output
• Actual Output
• Test Result

TEST TEST DATA EXPECTED ACTUAL TEST RESULT


USED OUTPUT OUTPUT

CmdOpen Opens the students Opened the file Works correctly


desired file the student
wanted

CmdSave Saves the student’s Saved the Works correctly


notes students notes

CmdExit Closes the Closes the Works correctly


notesaver students
notesaver

S-ar putea să vă placă și