示例#1
0
        //********************************************************************************************************
        private void btnView_Click(object sender, EventArgs e)      //View Appointments
        {
            frmDisplay DisplayForm = new frmDisplay();

            using (StreamReader sr = new StreamReader("Appointments.txt"))          //opens file reader, where Appointments are saved
            {
                var line = "";                                                      //decalration
                while ((line = sr.ReadLine()) != null)                              //read files untill there is nothing left
                {
                    DisplayForm.Appointments = line;                                //add files to the list box
                }
            }
            this.Hide();
            DisplayForm.Show();
        }
示例#2
0
        //*******************************************************************************************
        private void btnSearch_Click(object sender, EventArgs e)
        {
            frmDisplay Display = new frmDisplay();

            using (StreamReader sr = new StreamReader("Appointments.txt"))             //loads text file
            {
                string line;
                while ((line = sr.ReadLine()) != null)                          //reads text file, until there is a match or no more lines to read
                {
                    if (line.Contains(txtSearch.Text))
                    {
                        Display.Appointments = line;
                    }
                }
            }
            MessageBox.Show("If no clients are displayed, it means there was no match found");
            this.Hide();
            Display.Show();
        }