This is the project I am doing (code what i have done so far below):
Create an application that handles the recording of employee information for the payroll. A form allows the entry of the following data: employee id (integer), first name (string), last name (string), and salary (decimal). The form should have the buttons: Add (which adds the employee to the end of the Employees.txt sequential file), Clear (which clears all text boxes for a new employee entry), and Exit (which closes the form).
The employee id must be between 0 and 9999. If it is not within this range, an error message should be displayed to the user via an error message label on the form and the Add button disabled until an employee id within range is entered.
The salary must between 0 and 150000. If it is not within this range, an error message should be displayed to the user via an error message label on the form and the Add button disabled until a salary within range is entered.
On another form or in the same form (with additional buttons), allow the user to find an employee via the employee id. If the employee is not found, display an “Employee Not Found” in a label beside the Search button. If the employee is found, the employee’s info is displayed in the employee id, first name, last name, and salary text boxes. The user is allowed to edit any of these fields, except employee id. After they finish editing, the modified information for the employee is saved in their record when the user clicks on the Save button. There is an additional button, CalculateSS, which calculates Social Security deductions based on the employee’s salary (using the formula: Social Security Deductions = salary * 0.02). When the CalculateSS button is clicked, the social security deductions are calculated and appear in the Social Security Deductions label on the form. These deductions are also saved in the employee record (remember to save an empty field for the Social Security deductions). There is also a Clear and Close button whose functionalities are similar to the employee entry form.
So far i was able to get the program to write the information to text but i cant seem to get it to read the the sequential file... please helpCode:Option Strict On Option Explicit On Public Class PayrollForm Private path As String = "C:\Users\KeraBaby\Desktop\Payroll\Payroll Project Form\Payroll Project Form\bin\Debug\Employees.txt" Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub addBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addBtn.Click Dim path As String = "C:\Users\KeraBaby\Desktop\Payroll\Payroll Project Form\Payroll Project Form\bin\Debug\Employees.txt" Dim i As Integer Dim aryText(4) As String aryText(0) = Me.empIDbox.Text aryText(1) = Me.fnamebox.Text aryText(2) = Me.lnamebox.Text aryText(3) = Me.salbox.Text Dim objWriter As New System.IO.StreamWriter(path, True) For i = 0 To 3 objWriter.WriteLine(aryText(i)) Next objWriter.Close() End Sub Private Sub exitBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitBtn.Click Me.Close() End Sub Private Sub clrBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clrBtn.Click End Sub Private Sub empIDbox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles empIDbox.KeyPress If (e.KeyChar < Chr(48) Or e.KeyChar > Chr(57)) And e.KeyChar <> Chr(8) Then e.Handled = True addBtn.Enabled = False MessageBox.Show("Please enter only numeric values from 0 - 9999") addBtn.Enabled = True End If End Sub Private Sub salbox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles salbox.KeyPress If (e.KeyChar < Chr(48) Or e.KeyChar > Chr(57)) And e.KeyChar <> Chr(8) Then e.Handled = True addBtn.Enabled = False MessageBox.Show("Please enter only numeric values from 0 - 150000") addBtn.Enabled = True End If End Sub Private Sub cmdFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFind.Click 'Finds the employee associated with the employee ID entered by the user Dim ids() As String = {"txtUpdateID.Text"} Dim fname() As String = {"txtUpdateFirstName.Text"} Dim lname() As String = {"txtUpdateLastName.Text"} Dim sal() As Decimal = {CDec("Salupdate.Text")} Dim searchfor As String Dim Subscript As Integer 'assign the employee ID to a varible searchfor = Me.txtUpdateID.Text 'search the ids array for the product ID continue searching until there are no more array elements 'to search or the employee ID is found Do Until Subscript = ids.Length OrElse searchfor = ids(Subscript) Subscript = Subscript + 1 Loop 'determaine whether the product ID was found in the ids array If Subscript < ids.Length Then Me.txtUpdateFirstName.Text = fname(Subscript).ToString Me.txtUpdateLastName.Text = lname(Subscript).ToString Me.txtSalupdate.Text = sal(Subscript).ToString("C0") Else If empnf.Visible Then empnf.Visible = True Else empnf.Visible = False End If End If End Sub End Class
thank you




