Пример #1
0
        private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                DataGridViewRow dr = dataGridView1.SelectedRows[0];
                this.Hide();
                frmProduct frm = new frmProduct();
                frm.Show();
                frm.txtProductID.Text     = dr.Cells[0].Value.ToString();
                frm.txtProductName.Text   = dr.Cells[1].Value.ToString();
                frm.txtCategoryID.Text    = dr.Cells[2].Value.ToString();
                frm.cmbCategory.Text      = dr.Cells[3].Value.ToString();
                frm.txtSubCategoryID.Text = dr.Cells[4].Value.ToString();
                frm.cmbSubCategory.Text   = dr.Cells[5].Value.ToString();
                frm.txtFeatures.Text      = dr.Cells[6].Value.ToString();
                frm.txtPrice.Text         = dr.Cells[7].Value.ToString();
                byte[]       data = (byte[])dr.Cells[8].Value;
                MemoryStream ms   = new MemoryStream(data);
                frm.pictureBox1.Image = Image.FromStream(ms);
                frm.btnUpdate.Enabled = true;
                frm.btnDelete.Enabled = true;
                frm.btnSave.Enabled   = false;
                frm.txtProductName.Focus();
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void frmProductsRecord_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            frmProduct frm = new frmProduct();

            frm.Show();
        }
Пример #3
0
        private void productToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmProduct frm = new frmProduct();

            frm.Show();
        }