public void GetPsamCardID() { CIcRdr myRdr = new CIcRdr(); string sPort = ""; bHaveRd = false; for (int i = 1; i < 20; i++) { sPort = "Com" + i.ToString(); if (!myRdr.ComOpen(sPort)) { continue; } //Application.DoEvents(); if (!myRdr.Link()) { myRdr.ComClose(); continue; } if (!myRdr.GetPsamID()) { myRdr.ComClose(); continue; } bHaveRd = true; sRdPort = sPort; myRdr.ComClose(); break; } }