Example #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // read from notepad
            StreamReader reader = new StreamReader("postal codes.txt");
            string line = reader.ReadLine();

            while (line!=null)
            {
                string[] strings = line.Split(new[] { '\t' });
                PostalCode p1 = new PostalCode();
                p1.District = strings[0];
                p1.PoliceStation = strings[1];
                p1.SubOffice = strings[2];
                p1.PostCode = strings[3];
                allPostalCodes.Add(p1);
                line = reader.ReadLine();
            }

            dataGridView1.DataSource = allPostalCodes;
            // show in gridview
        }
Example #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // read from notepad
            StreamReader reader = new StreamReader("postal codes.txt");
            string       line   = reader.ReadLine();


            while (line != null)
            {
                string[]   strings = line.Split(new[] { '\t' });
                PostalCode p1      = new PostalCode();
                p1.District      = strings[0];
                p1.PoliceStation = strings[1];
                p1.SubOffice     = strings[2];
                p1.PostCode      = strings[3];
                allPostalCodes.Add(p1);
                line = reader.ReadLine();
            }

            dataGridView1.DataSource = allPostalCodes;
            // show in gridview
        }