很纠结的一个问题。关于提示框的
//编码文本框的回车事件
private void txtCode_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter&&enter==0)
{
DataRow[] drs = dttory.Select("cInvcode='" + txtCode.Text + "' or cbarcode='"+txtCode.Text+"' ");
if (drs.Length > 0)
{
cinvcode = drs[0]["cinvcode"].ToString();
txtName.Text = drs[0]["cinvname"].ToString();
txtNum.Text = "1";
txtPice.Text = drs[0]["iinvlscost"].ToString();//fretailprice
minpice = drs[0]["iinvlscost"].ToString();
igrouptype = drs[0]["igrouptype"].ToString();
bservice = drs[0]["bservice"].ToString();
itaxrate = Decimal.Parse(drs[0]["itaxrate"].ToString());
if (txtPice.Text.Length > 0)
{
txtMoney.Text =Decimal.Round((decimal.Parse(txtNum.Text) * decimal.Parse(txtPice.Text)),2).ToString();
}
else
{
txtMoney.Text = "0";
}
txtName.Enabled = true;
txtNum.Enabled = true;
txtPice.Enabled = true;
txtNum.Focus();
}
else
{
MessageBox.Show("此编码对应的商品不存在");
}
}
}
bool canEnter = true;
private void txtCode_KeyUp(object sender, KeyEventArgs e)
{
if (!canEnter) { canEnter = true; return; }
if (e.KeyCode == Keys.Enter&&enter==0)
{
DataRow[] drs = dttory.Select("cInvcode='" + txtCode.Text + "' or cbarcode='"+txtCode.Text+"' ");
if (drs.Length > 0)
{
cinvcode = drs[0]["cinvcode"].ToString();
txtName.Text = drs[0]["cinvname"].ToString();
txtNum.Text = "1";
txtPice.Text = drs[0]["iinvlscost"].ToString();//fretailprice
minpice = drs[0]["iinvlscost"].ToString();
igrouptype = drs[0]["igrouptype"].ToString();
bservice = drs[0]["bservice"].ToString();
itaxrate = Decimal.Parse(drs[0]["itaxrate"].ToString());
if (txtPice.Text.Length > 0)
{
txtMoney.Text =Decimal.Round((decimal.Parse(txtNum.Text) * decimal.Parse(txtPice.Text)),2).ToString();
}
else
{
txtMoney.Text = "0";
}
txtName.Enabled = true;
txtNum.Enabled = true;
txtPice.Enabled = true;
txtNum.Focus();
}
else
{
MessageBox.Show("此编码对应的商品不存在");
canEnter = false;
}
}
}