該程序正常工作。當出現提示並點擊「無效RFID」時,彈出無效RFID信息,並且我可以再次掃描。但是,如果RFID被接受,我希望提示關閉AUTOMATICALLY。在這個程序中,提示符沒有關閉AUTOMATICALLY。我必須添加什麼才能使提示關閉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();
}
}
}));
}
我試圖用this.Close();
在底部(下form.xResult = "OK";
),但它結束了掛。幫幫我!
你問[同樣的問題(http://stackoverflow.com/questions/15152754/how-to-close-the-prompt - 窗口)幾分鐘前,你刪除它。你爲什麼再問一次?你需要改進舊的才能獲得更好的答案。請閱讀[常見問題]和[問] – 2013-03-01 08:03:38
對不起。我在這裏更清楚了。 – Kael 2013-03-01 08:10:02