예제 #1
0
 private void cmbGoodsName_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
 {
     if (e.KeyChar == 13 && cmbGoodsName.Text.Trim() != "")
     {
         string strSpell = cmbGoodsName.Text.Trim();
         this.FillComboBoxBySpell(cmbGoodsName, "GoodsSpell", "vcGoodsName", "vcSpell", strSpell);
         CMSMData.CMSMStruct.GoodsStruct gs = new CMSMData.CMSMStruct.GoodsStruct();
         err = null;
         gs  = cs.GetGoodsByName(cmbGoodsName.Text.Trim(), out err);
         if (gs != null)
         {
             txtGoodsID.Text   = gs.strGoodsID;
             cmbGoodsName.Text = gs.strGoodsName;
             txtPrice.Text     = gs.dPrice.ToString();
             txtCount.Text     = "1";
             cmbGoodsName.Focus();
         }
         else
         {
             if (err != null)
             {
                 clog.WriteLine(err);
             }
             MessageBox.Show("无此商品信息!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
             cmbGoodsName.Text = "请输入...";
             cmbGoodsName.Focus();
             return;
         }
     }
 }