Declare a class-level array that contains five employee

Assignment Help Computer Engineering
Reference no: EM132217544

Zander Inc. stores employee IDs and salaries in a sequential access file named Employees.txt.

Open the VB2015\Chap10\Zander Solution\Zander Solution (Zander Solution.sln) file. Open the Employees.txt file, which is contained in the project's bin\Debug folder. The ID and salary information appear on separate lines in the file. Close the Employees.txt window.

a. Define a structure named Employee. The structure should contain two member variables:

a String variable to store the ID and a Double variable to store the salary.

b. Declare a class-level array that contains five Employee structure variables.

c. The frmMain_Load procedure should read the IDs and salaries from the Employees.txt file and store them in the class-level array. It should also add the IDs to the list box.

d. When the user selects an employee ID in the list box, the employee's salary should appear in the lblSalary control.

e. Test the application appropriately.

As of right now this is my code i have 2 errors i will put them in bold. will put in a picture of how it suppose to look.

Option Explicit On
Option Strict On
Option Infer Off

Public Class frmMain
Structure Employee
Public strID As String
Public dblSalary As String
End Structure
Private emp(4) As Employee
Private strfile As String = "Employees.txt"

Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim inFile As IO.StreamReader
Dim strId As String
Dim intSub As Integer = 0

If IO.File.Exists(strfile) Then
inFile = IO.File.OpenText(strfile)
Do Until inFile.Peek = -1
strId = inFile.ReadLine
lstIds.Items.Add(strId)
emp(intSub).strID = strId
emp(intSub).dblSalary = Convert.ToDouble(inFile.ReadLine)
intSub += 1
Loop
inFile.Close()

lstIds.SelectedIndex = 0
Else
MessageBox.Show("Can't find" & strfile & "File", "Employees", MessageBoxButtons.OK)
End If
End Sub
Private Sub lstIds_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstIds.SelectedIndexChanged
For Each dbElement As Employee In emp
If lstIds.SelectedItem.ToString = dbElement.strID Then
lblSalary.Text = dbElement.dblSalary.ToString("C2")
End If
Next
End Sub

Reference no: EM132217544

Questions Cloud

What is the name of the buyer who bought item : You are setting up your own business by developing an Electronic Auction website for the staff, students, and faculty of your University.
Prepare your responses on the given post : Anders is 26 years old and single. He accepted a position with a global non-governmental organization (NGO) to work on a health project in Uganda.
Determine the minimum number of open areas needed : A zoo is going to place its animals in a set of large open areas, instead of having them in individual cages.
Prepare a contribution format income statement for the year : Assume that the company produces and sells 81,000 units during the year at a selling price of $9.93 per unit. Prepare a contribution format income statement.
Declare a class-level array that contains five employee : Define a structure named Employee. The structure should contain two member variables: a String variable to store the ID and a Double variable to store.
Write a program that reads in a 10-digit phone number : Write a program that reads in a 10-digit phone number and displays a message that states whether or not the number is toll free.
What type of account you used to record advance receipt : What is the type of account you used to record the advance receipt of money on Dec. 8th from North construction? Did the balance of that account change.
Calculate the factorial of a non-negative integer : Calculates the factorial of a non-negative integer, that is, the product of * all integers between 1 and the given integer, inclusive.
Compute the income from subsidiary : Preparing a consolidated income statementâ€"Equity method with noncontrolling interest, AAP and upstream and downstream intercompany inventory profits.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd