![]() ![]() ![]() ![]() |
|||||
|
|||||
樓主 Tommas Huang ![]()
![]() |
當執行目前程式 - daKeyt = Byte.Parse(cmKeyt.Text), 會顯示 System.FormatException: '輸入字串格式不正確。要怎麼修正程式? 目前程式如下 *btnGetUID_Click 測試是可行的 *btnGetData_Click 是問題點 請各位提供小弟我意見,解決目前疑惑點。謝謝大家的協助。 unsafe public void btnGetdata_Click(object sender, EventArgs e) //Get Sector, Black, Key type, Load key { UInt32 uiLength, uiRead, uiResult, uiWritten; byte daKeyt, daLoadk, daSector, daBlock; byte[] ReadBuffer = new byte[0x40]; byte[] WriteBuffer = new byte[] { 0x60, 0x61, 0x15, 0x02, 0x04, 0x13, 0x00, 0x00, 0x01 }; //Command {STX, LEN, CMD, DATA1, DATA2.....} //宣告ComboBox and Text 變數 daKeyt = Byte.Parse(cmKeyt.Text); daLoadk = Byte.Parse(txLoadk.Text); daSector = Byte.Parse(cmSector.Text); daBlock = Byte.Parse(cmBlock.Text); byte[] sResponse = null; sResponse = new byte[21]; EasyPOD.VID = 0xe6a; EasyPOD.PID = 0x317; Index = 1; uiLength = 64; fixed (MW_EasyPOD* pPOD = &EasyPOD) { dwResult = PODfuncs.ConnectPOD(pPOD, Index); if ((dwResult != 0)) { MessageBox.Show("Reader Not Connected"); } else { EasyPOD.ReadTimeOut = 200; EasyPOD.WriteTimeOut = 200; dwResult = PODfuncs.WriteData(pPOD, WriteBuffer, 12, &uiWritten); //Send a request command to reader uiResult = PODfuncs.ReadData(pPOD, ReadBuffer, uiLength, &uiRead); //Read the response data from reader txOutput.Text = BitConverter.ToString(ReadBuffer, 4, (Int32)uiRead-4).Replace("-", " "); //HEX } dwResult = PODfuncs.ClearPODBuffer(pPOD); dwResult = PODfuncs.DisconnectPOD(pPOD); } }
搜尋相關Tags的文章:
[ C# 讀取Mifare ISO144 該如何定義及抓取下拉式清單裡的值放到Writer Buffer ] ,
本篇文章發表於2017-10-14 20:38 |