Example #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            BugTrackers cs = Bugs[index];

            // DisplayBugs();
            // Update datafile
            UpdateBugsInfo();
        }
Example #2
0
        private void ReadFile()
        {
            try
            {
                //Declare a varialble to hold Bugs Name
                StreamReader inputFile;       // To Read the file
                string       line;            // To hold a line from the file

                // Create an instance of the Bug Accounts
                BugTrackers entry = new BugTrackers();

                // Create a delimeter array
                char[] delim = { ',' };

                // Open the file and get a StreamReader Object
                inputFile = File.OpenText("smBugs.txt");

                // Read the file's contents
                while (!inputFile.EndOfStream)
                {
                    // Read a line from the file
                    line = inputFile.ReadLine();

                    // Tokenize the line
                    string[] tokens = line.Split(delim);

                    // Stores the tokens in the entry object
                    entry.BugsName = tokens[0];
                    entry.BugsDesc = tokens[1];

                    // Add the entry object to the combobox
                    Bugs.Add(entry);
                }
                // Close the File
                inputFile.Close();
            }
            catch (Exception ex)
            {
                // Display an error message
                MessageBox.Show(ex.Message);
            }
        }