예제 #1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string ColName = dataGridView1.Columns[e.ColumnIndex].Name;

            if (ColName == "Edit")
            {
                Form2Brand FormTwoBrand = new Form2Brand(this);
                FormTwoBrand.LabelOfID.Text       = dataGridView1[1, e.RowIndex].Value.ToString();
                FormTwoBrand.BrandTextBox.Text    = dataGridView1[2, e.RowIndex].Value.ToString();
                FormTwoBrand.SaveButton.Enabled   = false;
                FormTwoBrand.UpdateButton.Enabled = true;
                FormTwoBrand.ShowDialog();
            }
            else if (ColName == "Delete")
            {
                if (MessageBox.Show("Delete this record?", "Delete Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    cn.Open();
                    cm = new SqlCommand("delete from BrandTable where id like '" + dataGridView1[1, e.RowIndex].Value.ToString() + "'", cn);
                    cm.ExecuteNonQuery();
                    cn.Close();
                    MessageBox.Show("Done!", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadRecords();
                }
            }
        }
예제 #2
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            Form2Brand form2Brand = new Form2Brand(this);

            form2Brand.SaveButton.Enabled   = true;
            form2Brand.UpdateButton.Enabled = false;
            form2Brand.ShowDialog();
        }
예제 #3
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            Form2Brand form2Brand = new Form2Brand();

            form2Brand.ShowDialog();
        }