コード例 #1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                string ColName = dataGridView1.Columns[e.ColumnIndex].Name;


                if (ColName == "Select")
                {
                    QtyForm qf = new QtyForm(posform);
                    qf.ProductDetails(dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(), Double.Parse(dataGridView1.Rows[e.RowIndex].Cells[7].Value.ToString()), posform.TransNoLbl.Text, int.Parse(dataGridView1.Rows[e.RowIndex].Cells[8].Value.ToString()));
                    qf.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #2
0
        private void SearchTb_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (SearchTb.Text == String.Empty)
                {
                    return;
                }
                else
                {
                    connect.Open();
                    command    = new MySqlCommand("SELECT * FROM producttbl WHERE barcode like '" + SearchTb.Text + "'", connect);
                    DataReader = command.ExecuteReader();
                    DataReader.Read();

                    if (DataReader.HasRows)
                    {
                        qty = int.Parse(DataReader["qty"].ToString());
                        QtyForm qf = new QtyForm(this);
                        qf.ProductDetails(DataReader["pcode"].ToString(), double.Parse(DataReader["price"].ToString()), TransNoLbl.Text, qty);
                        DataReader.Close();
                        connect.Close();
                        qf.ShowDialog();
                    }

                    else
                    {
                        DataReader.Close();
                        connect.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                connect.Close();
                MessageBox.Show(ex.Message, stitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }