Example #1
0
        private void btnAddRow_Click(object sender, EventArgs e)
        {
            if (dataGridView1.RowCount < 11)
            {
                //DataTable dt = (DataTable)dataGridView1.DataSource;
                //DataRow row = dt.NewRow();
                //dt.Rows.Add(row);
                //dataGridView1.DataSource = dt;
                //dataGridView1.ClearSelection();

                AddAlternativeForm addAlternativeForm = new AddAlternativeForm("Add", "", -1);
                addAlternativeForm.ShowDialog(this);

                mainForm.updateTooltipVisibility();
            }
            else
            {
                MessageBox.Show(this, "Maximum number of alternative reached", "Add New Row", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
Example #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            string errMsg = "";

            if (dataGridView1.RowCount == 0)
            {
                errMsg = "No row to be edited";
            }
            else if (dataGridView1.SelectedCells.Count == 0)
            {
                errMsg = "Select row to be edited";
            }
            else
            {
                AddAlternativeForm addAlternativeForm = new AddAlternativeForm("Edit", dataGridView1.SelectedCells[0].Value.ToString(), this.selectedRowIdx);
                addAlternativeForm.ShowDialog(this);
            }

            if (errMsg != "")
            {
                MessageBox.Show(this, errMsg, "Edit Alternative Row", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
        private void numericUpDown1_KeyDown(object sender, KeyEventArgs e)
        {
            AddAlternativeForm addAlternativeForm = (AddAlternativeForm)this.ParentForm;

            addAlternativeForm.txtAlternativeName_KeyDown(this, e);
        }