Beispiel #1
0
        private void buttonViewPro_Click(object sender, EventArgs e)
        {
            this.Visible  = false;
            ShowInTaskbar = false;

            FormViewPro viewPro = new FormViewPro();

            viewPro.Show();
        }
Beispiel #2
0
        private void buttonDelView_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(@"Data Source=EMMANUELSAL\EMAN_SQL;Initial Catalog=POS1;Integrated Security=True");

            if (comboBoxBrandView.Text == "")
            {
                MessageBox.Show("Please fill the combobox.....");
                return;
            }
            else
            {
                if (MessageBox.Show("Are you sure to delete " + comboBoxBrandView.Text + " product?",
                                    "",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Information) == DialogResult.Yes)

                {
                    con.Open();
                    SqlCommand cmd = con.CreateCommand();
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "Delete from addPro where ProductName = '" + comboBoxBrandView.Text + "'";


                    cmd.ExecuteNonQuery();
                    con.Close();

                    MessageBox.Show("Deleted!");
                    comboBoxBrandView.Text = string.Empty;
                    DisplayData();
                    FormViewPro view = new FormViewPro();
                    this.Visible  = false;
                    ShowInTaskbar = false;
                    view.Show();
                }
                else
                {
                    return;
                }
            }
        }