Ejemplo n.º 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            SubClsTxtFileIO objSubClsTxtFileIO = new SubClsTxtFileIO();



            try
            {
                objSubClsTxtFileIO.PopulateEmployees(empArray2);
                this.Text = objSubClsTxtFileIO.RecordsRead.ToString() + "   " + recordCount.ToString();

                if ((recordCount + 1) < objSubClsTxtFileIO.RecordsRead)
                {
                    label5.Text  = empArray2[recordCount].EmployeeFName;
                    label6.Text  = empArray2[recordCount].EmployeeLName;
                    label7.Text  = empArray2[recordCount].Department;
                    label8.Text  = empArray2[recordCount].PhoneNumber;
                    label9.Text  = empArray2[recordCount].AnnualSalary;
                    label11.Text = empArray2[recordCount].VacationDaysEarned;
                    label13.Text = empArray2[recordCount].CalculateVacationValue().ToString();
                }
                else
                {
                    recordCount  = 0;
                    label5.Text  = empArray2[recordCount].EmployeeFName;
                    label6.Text  = empArray2[recordCount].EmployeeLName;
                    label7.Text  = empArray2[recordCount].Department;
                    label8.Text  = empArray2[recordCount].PhoneNumber;
                    label9.Text  = empArray2[recordCount].AnnualSalary;
                    label11.Text = empArray2[recordCount].VacationDaysEarned;
                    label13.Text = empArray2[recordCount].CalculateVacationValue().ToString();
                }
                recordCount++;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            SubClsTxtFileIO objSubClsTxtFileIO = new SubClsTxtFileIO();

            ClsEmployee[] empArray = new ClsEmployee[200];

            //Initialize all elements to instances of the ClsEmployee Class:
            for (int i = 0; i < empArray.Length; i++)
            {
                empArray[i] = new ClsEmployee();
            }

            listBox1.Items.Clear();



            objSubClsTxtFileIO.PopulateEmployees(empArray);

            //MessageBox.Show("Made It");
            for (int i = 0; i < objSubClsTxtFileIO.RecordsRead; i++)
            {
                listBox1.Items.Add(empArray[i].EmployeeFName + " " + empArray[i].PhoneNumber);
            }
        }