简体   繁体   English

如何关闭提示窗口?

[英]How to close the prompt window?

The program works properly. 该程序正常运行。 When the prompt appears and an "Invalid RFID" is tapped, the Invalid RFID message pops up and I am able to scan again. 当出现提示并点击“无效的RFID”时,弹出无效的RFID消息,我可以再次扫描。 However, if the RFID gets accepted, I want the prompt to close AUTOMATICALLY. 但是,如果RFID被接受,我希望提示自动关闭。 In this program, the prompt is not closing AUTOMATICALLY. 在此程序中,提示未自动关闭。 What must I add to make the prompt close AUTOMATICALLY? 我必须添加什么才能使提示自动关闭?

private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
    {
        string ramses = serialPort1.ReadLine();
        SetRFIDText(ramses);

    }

    private string dotRFID = "";
    private bool shouldClose = false;

    protected void SetRFIDText(string input)
    {
        this.Invoke(new Function(delegate()
        {
            string Hexed = new LasalleRFIDComputerRentals.BLL.DAL.Utils().HexIt(input);

            dotRFID = Hexed.Trim();
            txtRFID.Text = Hexed.Trim();


            if (txtRFID.Text.Trim() == "")
            {
                MessageBox.Show(this, "Please provide the member's RFID.", "Save Member Information", MessageBoxButtons.OK);
                txtRFID.Focus();
                return;
            }

            CustomerInfo customer = new Customer().GetCustomerByRFID(txtRFID.Text);
            if (customer.CustomerID <= 0)
            {
                MessageBox.Show(this, "Incorrect RFID.", "Validation", MessageBoxButtons.OK);
                return;
            }
            else
            {

                txtRFID.Text = "";



                if (_parentForm == "StandBy")
                {
                    Utils.CurrentCustomer.CustomerInfo = customer;
                    frmStandBy form = (frmStandBy)this.Owner;
                    form.xResult = "OK";
                    this.Close();

                }

            }
           }));

    }

I tried using that this.Close(); 我尝试使用this.Close(); in the bottom (under form.xResult = "OK"; ) but it ends up hanging. 在底部(在form.xResult = "OK";之下),但最终挂起。 Help! 救命!

Well, I was able to make it work by changing This.Close(); 好吧,我可以通过更改This.Close();使它起作用This.Close(); to This.Hide(); This.Hide();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM