Exemplo n.º 1
0
        private void cmbitemname_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Enter)
            {
                try
                {
                    if (cmbitemname.Text != null)
                    {
                        con = new OleDbConnection(lblpath.Text);
                        con.Open();
                        cmd = con.CreateCommand();

                        cmd.CommandText = "SELECT ITEMID,UNITID,UNITNAME,SALERATE,MRP,TAXID,TAXNAME FROM ItemMaster WHERE ITEMNAME='" + cmbitemname.Text + "'";
                        rdr             = cmd.ExecuteReader();
                        while (rdr.Read())
                        {
                            txtitemno.Text  = (rdr["ITEMID"].ToString());
                            lblunitid.Text  = (rdr["UNITID"].ToString());
                            txtunit.Text    = (rdr["UNITNAME"].ToString());
                            txtprice.Text   = (rdr["SALERATE"].ToString());
                            txtmrp.Text     = (rdr["MRP"].ToString());
                            lblTaxid.Text   = (rdr["TAXID"].ToString());
                            txttaxname.Text = (rdr["TAXNAME"].ToString());
                        }
                        rdr.Close();
                        con.Close();
                        txtSerialNo.Focus();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            if (e.KeyData == Keys.F3)
            {
                try
                {
                    Form fc = Application.OpenForms["PRODUCTCREATION"];

                    if (fc == null)
                    {
                        PRODUCTCREATION frm = new PRODUCTCREATION();
                        frm.lblpath.Text = lblpath.Text;
                        frm.ShowDialog();
                    }


                    //  new PRODUCTCREATION(this).Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
 public GROUP(PRODUCTCREATION frm)
 {
     InitializeComponent();
     ths          = frm;
     lblpath.Text = ths.lblpath.Text;
 }