Exemple #1
0
 private void dataGridViewX1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyValue == 27)
     {
         dataGridViewX1.Visible = false;
         Ptxt3.Focus();
     }
     if (e.KeyValue == 13)
     {
         dataGridViewX1.Visible = false;
         Ptxt3.Focus();
     }
 }
Exemple #2
0
 private void maskedTextBox1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyValue == 27)
     {
         this.Close();
     }
     if (e.KeyValue == 13)
     {
         con.connection();
         DataTable dt = con.show_data("select code'کد مشتری',name+N' '+family'نام و نام خانوادگی' from moshtary where code = N'" + txt1.Text + "' AND codemar = N'" + function.Code_markaz + "' ");
         con.Disconnect();
         if (dt.Rows.Count == 0)
         {
             txt2.Text = "";
             txt1.Text = "";
         }
         else
         {
             txt1.Text = dt.Rows[0].ItemArray.GetValue(0).ToString();
             txt2.Text = dt.Rows[0].ItemArray.GetValue(1).ToString();
         }
         Ptxt3.Focus();
     }
     if (e.KeyCode == Keys.Down)
     {
         dataGridViewX1.Visible = true;
         dataGridViewX1.Focus();
         con.connection();
         if (txt1.Text == "")
         {
             sql = "select code'کد مشتری',name+N' '+family'نام و نام خانوادگی' from moshtary";
         }
         else
         {
             sql = "select code'کد مشتری',name+N' '+family'نام و نام خانوادگی' from moshtary where (code LIKE N'" + txt1.Text + "%') AND (codemar = N'" + function.Code_markaz + "')";
         }
         dataGridViewX1.DataSource = con.show_data(sql);
         con.Disconnect();
     }
 }