该程序正常工作。当出现提示并点击“无效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