In: Computer Science
Hide Folder Information |
|
Turnitin® | |
This assignment will be submitted to Turnitin®. | |
Instructions | |
The Final Project for this course is the creation of an employee database. This assignment will give you some insight into how Visual Basic programming can be useful in the real world. As you work on this application, try to make it presentable like an application you would want to use if you were using an employee database application. Feel free to incorporate pictures to make it appeal to the user….be creative. Keep in mind the things you learned such as tab order and exception handling for user experience on the front end. Also, think about the coding you are doing and make sure you comment your code and follow Visual Basic standard conventions. What if a new developer were to make changes to the application? Will they understand your intentions and what the code is doing? Complete the following Programming Challenges: Programming Challenge #1 - Creating Employee Data found on page 625 of the textbook. Programming Challenge #2 - Reading Employee Data found on page 625-626 of the textbook. Programming Challenge #12 - Employee Data, Enhanced found on page 629 of the textbook. Specifically, be sure to meet the following criteria:
|
Imports
System.IO
Public
Class
frmEmployeeDataPart2
' Declare global
variables
Dim
recordNumber
As
Integer
= 1
Dim
filename
As
String
Dim
sr
As
StreamReader
Dim
message
As
String
Dim
fileValid
As
Boolean
=
False
Private
Sub
frmEmployeeDataPart2_Load(sender
As
Object
, e
As
EventArgs)
Handles
MyBase
.Load
'
Ask the user for the name of the text file and opens the
file
'
Checks user input to make sure that the file name is
valid
Do
filename
= InputBox(
"Input Needed"
,
"Enter the name of the file."
)
If
File.Exists(filename)
Then
sr
= File.OpenText(filename)
fileValid
=
True
Else
message
=
"Either no file has yet been created or the file
"
message
&=
"is not where expected."
MessageBox.Show(message,
"File Not Found"
)
fileValid
=
False
End
If
Loop
Until
fileValid =
True
End
Sub
Private
Sub
btnClear_Click(sender
As
Object
, e
As
EventArgs)
Handles
btnClear.Click
'
clears all of the fields when the Clear button is
pressed
lblRecordNumber.Text
=
""
lblFirstName.Text
=
""
lblMiddleName.Text
=
""
lblLastName.Text
=
""
lblEmployeeNumber.Text
=
""
lblDepartment.Text
=
""
lblTelephone.Text
=
""
lblExtension.Text
=
""
lblEmailAddress.Text
=
""
End
Sub
Private
Sub
btnExit_Click(sender
As
Object
, e
As
EventArgs)
Handles
btnExit.Click
'
Ends the program when the Exit button is pressed.
End
End
Sub
Private
Sub
btnNext_Click(sender
As
Object
, e
As
EventArgs)
Handles
btnNext.Click
If
sr.EndOfStream =
True
Then
MessageBox.Show(
"End
of file"
)
Else
lblRecordNumber.Text
=
CStr
(recordNumber)
lblFirstName.Text
= sr.ReadLine
lblMiddleName.Text
= sr.ReadLine
lblLastName.Text
= sr.ReadLine
lblEmployeeNumber.Text
= sr.ReadLine
lblDepartment.Text
= sr.ReadLine
lblTelephone.Text
= sr.ReadLine
lblExtension.Text
= sr.ReadLine
lblEmailAddress.Text
= sr.ReadLine
recordNumber
+= 1
End
If
End
Sub
End
Class