示例#1
0
        private void product_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            String code = product.Rows[e.RowIndex].Cells[colProductCode.Name].Value.ToString();

            txtCode.Text        = null;
            txtDescription.Text = null;
            txtCategory.Text    = null;
            if (GetProduct(code))
            {
                if (String.IsNullOrEmpty(Codes.ToString()) || Codes.Equals(""))
                {
                    var dRow = DataSupport.RunDataSet("Select * from products where product_id ='" + code + "'").Tables[0];
                    foreach (DataRow row in dRow.Rows)
                    {
                        txtCode.Text        = row["product_id"].ToString();
                        txtDescription.Text = row["description"].ToString();
                        txtCategory.Text    = row["category"].ToString();
                    }
                    tabControl1.SelectedTab = tabPage2;
                }
                else
                {
                    tabControl1.SelectedTab = tabPage2;
                }
                label9.Visible    = false;
                txtSearch.Visible = false;
            }
        }