public void btn_Write_Click(object sender, EventArgs e) { try { String tmpStr = ""; byte[] buff = new byte[16]; //tmpStr = textBoxData.Text; //buff = Encoding.ASCII.GetBytes(tmpStr); buff = System.Text.Encoding.Default.GetBytes(tmpStr); // AscW() if (buff.Length < 16) { Array.Resize(ref buff, 16); } mifareClassic.updateBinary((byte)int.Parse("02"), buff, (byte)int.Parse("16")); //textBoxData.Text = ""; } catch (PcscException pcscException) { //MessageBox.Show(pcscException.Message, "PCSC Exception"); } catch (Exception ex) { } }