Data received output http://postimg.org/image/5hvqgosc7/
This is the string display of RFID tag number. Is it really this one shows up for all rfid or can I change it to display numbers only without spaces and symbols?
or is there a problem in my code.
This is my code:
private void Form1_Load(object sender, EventArgs e)
{
cn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Thesis\Desktop\Projects\Employees.accdb;Persist Security Info=True";
cmd.Connection = cn;
this.myDelegate = new AddDataDelegate(AddDataMethod);
rfidbox.Enabled = true;
string[] ports = SerialPort.GetPortNames();
foreach (string port in ports)
{
SerialPort mySerialPort = new SerialPort(port);
mySerialPort.BaudRate = 9600;
mySerialPort.Parity = Parity.None;
mySerialPort.StopBits = StopBits.One;
mySerialPort.DataBits = 8;
mySerialPort.ReadTimeout = 3000;
mySerialPort.Handshake = Handshake.None;
mySerialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);
mySerialPort.Open();
}
}
private void DataReceivedHandler( object sender, SerialDataReceivedEventArgs e)
{
SerialPort sp = (SerialPort)sender;
string s = sp.ReadExisting();
rfidbox.Invoke(this.myDelegate, new Object[]{s});
}
public void AddDataMethod(String myString)
{
rfidbox.AppendText(myString);
}
Thanks for help in advance.