Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            Data[location] = new ClsEmployee();

            if (location != 2)
            {
                for (int i = location; i <= totalNum - 1; i++)
                {
                    Data[i] = Data[i + 1];
                }
            }
            else
            {
                location = -1;
            }
            totalNum--;

            ClsTxtFileIO objFile = new ClsTxtFileIO();

            objFile.CreateFile();

            for (int i = 0; i <= totalNum - 1; i++)
            {
                objFile.AppendRecords(Data[i].EmployeeFName, Data[i].EmployeeLName, Data[i].Department, Data[i].PhoneNumber, Data[i].AnnualSalary, Data[i].VacationDaysEarned);
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            string       inRec;
            ClsTxtFileIO objFile = new ClsTxtFileIO();

            objFile.OpenForRead();
            try
            {
                inRec = objFile.ReadRecord();; //stores each line read from file - returns "null at end of file

                while (inRec != null)
                {
                    //this.Text += "*";
                    listBox1.Items.Add(inRec);
                    inRec = objFile.ReadRecord();
                }

                objFile.CloseForRead();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Trap: " + ex.ToString());
            }
        }
Example #3
0
        private void button3_Click(object sender, EventArgs e)
        {
            ClsTxtFileIO objFile = new ClsTxtFileIO();

            objFile.OverWriteRecords(textBox7.Text, textBox8.Text, textBox9.Text, textBox10.Text);
            textBox7.Text  = "";
            textBox8.Text  = "";
            textBox9.Text  = "";
            textBox10.Text = "";
            textBox7.Focus();
        }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            ClsTxtFileIO objFile = new ClsTxtFileIO();//Instantiate custom class with Text File IO functions

            objFile.AppendRecords(textBox7.Text, textBox8.Text, textBox9.Text, textBox10.Text, textBox11.Text, "0");
            textBox7.Text  = "";
            textBox8.Text  = "";
            textBox9.Text  = "";
            textBox10.Text = "";
            textBox7.Focus();
        }
Example #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                Data[location].VacationDaysEarned = textBox1.Text;
            } catch
            {
                Console.WriteLine("ERR");
                textBox1.Text = "";
                textBox1.Focus();
            }

            ClsTxtFileIO objFile = new ClsTxtFileIO();

            objFile.CreateFile();

            for (int i = 0; i <= totalNum - 1; i++)
            {
                objFile.AppendRecords(Data[i].EmployeeFName, Data[i].EmployeeLName, Data[i].Department, Data[i].PhoneNumber, Data[i].AnnualSalary, Data[i].VacationDaysEarned);
            }
        }
Example #6
0
        private void button4_Click(object sender, EventArgs e)
        {
            ClsTxtFileIO objFile = new ClsTxtFileIO();

            objFile.CreateFile();
        }