Example #1
0
        public Form1()
        {
            InitializeComponent();
            foreach (DataGridViewColumn column in dataGridView1.Columns)
            {
                column.SortMode = DataGridViewColumnSortMode.NotSortable;
            }
            Form2 form2 = new Form2(this);

            form2.Show();
            map      = new Dictionary <char, int>();
            map['A'] = 0;
            map['B'] = 1;
            map['C'] = 2;
            map['D'] = 3;
            map['X'] = 4;
            map['E'] = 5;
            map['F'] = 6;
            map['G'] = 7;
            map['H'] = 8;
            map['Y'] = 9;
            map['I'] = 10;
            map['J'] = 11;
            map['K'] = 12;
            map['L'] = 13;
            map['a'] = 0;
            map['b'] = 1;
            map['c'] = 2;
            map['d'] = 3;
            map['x'] = 4;
            map['e'] = 5;
            map['f'] = 6;
            map['g'] = 7;
            map['h'] = 8;
            map['y'] = 9;
            map['i'] = 10;
            map['j'] = 11;
            map['k'] = 12;
            map['l'] = 13;
            rows     = dataGridView1.Rows;
            rows.Add(new Object[] { "A" });
            rows.Add(new Object[] { "B" });
            rows.Add(new Object[] { "C" });
            rows.Add(new Object[] { "D" });
            rows.Add(new Object[] { "X" });
            rows.Add(new Object[] { "E" });
            rows.Add(new Object[] { "F" });
            rows.Add(new Object[] { "G" });
            rows.Add(new Object[] { "H" });
            rows.Add(new Object[] { "Y" });
            rows.Add(new Object[] { "I" });
            rows.Add(new Object[] { "J" });
            rows.Add(new Object[] { "K" });
            rows.Add(new Object[] { "L" });
            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                for (int j = 0; j < dataGridView1.ColumnCount; j++)
                {
                    if (i == 4 || i == 9)
                    {
                        rows[i].Cells[j].Style.BackColor = Color.Green;
                    }
                }
            }
            Courses = new List <Course>();
            form2.focus();
        }