Exemple #1
0
        private void OpenCategoryListForm(DataGridView dgv)
        {
            CloseOpenedCategoryForm();

            List <int> rowIndexList = new List <int>();

            foreach (DataGridViewRow row in dgv.SelectedRows)
            {
                if (IsLastEmptyRow(dgv, row.Index))
                {
                    break;
                }
                rowIndexList.Add(row.Index);
            }

            CategoryListForm form = new CategoryListForm(dgv, rowIndexList);

            form.Location = new Point(this.Location.X + 300, this.Location.Y);
            form.Show();
        }
Exemple #2
0
        private void EarningDataGridViewCellClicked(object sender, DataGridViewCellEventArgs e)
        {
            if (IsLastEmptyRow(EarningDataGridView, e.RowIndex) || e.RowIndex == -1)
            {
                return;
            }

            //if it's category column
            if (e.ColumnIndex == 2)
            {
                //first close if any CategoryList form is already open
                CloseOpenedCategoryForm();

                List <int> rowIndexList = new List <int>();
                rowIndexList.Add(e.RowIndex);
                CategoryListForm catForm = new CategoryListForm(EarningDataGridView, rowIndexList);
                catForm.Location = new Point(this.Location.X + 300, this.Location.Y);
                catForm.Show();
            }
        }