簡體   English   中英

如何關閉提示窗口?

[英]How to close the prompt window?

該程序正常運行。 當出現提示並點擊“無效的RFID”時,彈出無效的RFID消息,我可以再次掃描。 但是,如果RFID被接受,我希望提示自動關閉。 在此程序中,提示未自動關閉。 我必須添加什么才能使提示自動關閉?

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();

                }

            }
           }));

    }

我嘗試使用this.Close(); 在底部(在form.xResult = "OK";之下),但最終掛起。 救命!

好吧,我可以通過更改This.Close();使它起作用This.Close(); This.Hide();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM