when tap only get 1 digit

耗尽温柔 提交于 2019-12-12 04:39:07

问题


for my rfid card value was

the case is when i tap why the text was not empty ? and when i tap the second card it only give me 1 digit

card2 tap

the code i use

 private void textEdit1_KeyPress(object sender, KeyPressEventArgs e)
    {

        if (this.textEdit1.Text.Length == 10)
        {
            getcodestudent();
            this.textEdit1.Text = "";
        }
    }

for getcodestudent()

  public void getcodestudent()
    {
        SqlDataAdapter adapter = new SqlDataAdapter();
        SqlParameter para2 = new SqlParameter();
        try
        {
            ds6.Clear();
            dt6.Clear();

            command6.Connection = myConnection;
            command6.CommandText = //..//;                               
            adapter.SelectCommand = command6;
            adapter.Fill(ds6);
            adapter.Fill(dt6);                               
        }
        catch (Exception ex)
        {
            MessageBox.Show("error" + ex);

        }
        if (dt6.Rows.Count == 1)
        {
            member = ds6.Tables[0].Rows[0][0].ToString();
            MessageBox.Show(member);
        }

but if i delete the text after tapping with card with backspace and then tap again with card, it works perfectly fine on running getcodestudent(); this.textEdit1.Text = "";

来源:https://stackoverflow.com/questions/39652317/when-tap-only-get-1-digit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!