Exemple #1
0
        private void BtnAdd_Click(object sender, System.EventArgs e)
        {
            var frm = new Form_UnitAddEdit
            {
                unitCode = ""
            };

            if (frm.ShowDialog() == DialogResult.OK)
            {
                Populate();
            }
        }
Exemple #2
0
        private void Gv_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DataGridView senderGrid = (DataGridView)sender;

                if (senderGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn && e.RowIndex >= 0)
                {
                    string unitCode = gv.Rows[e.RowIndex].Cells[1].Value.ToString();
                    var    frm      = new Form_UnitAddEdit
                    {
                        unitCode = unitCode
                    };
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        Populate();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }