Example #1
0
        //private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        //{
        //    if (dataGridView1.CurrentCell.ColumnIndex == 0)
        //    {
        //        // Check box column
        //        ComboBox comboBox = e.Control as ComboBox;
        //        comboBox.SelectedIndexChanged += new EventHandler(comboBox_SelectedIndexChanged);
        //    }
        //}
        //void comboBox_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    int selectedIndex = ((ComboBox)sender).SelectedIndex;

        //}

        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            var id         = int.Parse(dataGridView1.CurrentRow.Cells["id"].Value.ToString());
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                switch (senderGrid.Columns[e.ColumnIndex].HeaderText)
                {
                case "#":
                    frm_add_item _update_item = new frm_add_item(this, id);
                    _update_item.ShowDialog();

                    break;

                case "##":
                    //dataGridView1.Rows.Remove(dataGridView1.CurrentRow);
                    //Item item = new Item();
                    //item.Id = id;
                    //item.DeleteTempItemsPerId();
                    //this.Items();
                    break;

                default:
                    break;
                }
            }
        }
Example #2
0
        private void button4_Click_1(object sender, EventArgs e)
        {
            frm_add_item _add_item = new frm_add_item(this);

            _add_item.ShowDialog();
        }