Click here to Skip to main content
16,023,339 members

Comments by anshumandas (Top 2 by date)

anshumandas 13-Jun-16 23:29pm View    
I am also using this code but the delegate is not reading the card and not showing any data in the text box.I am using the following configuration:
Port No : Com3
Baud Rate: 9600
Parity None
Data Bit 8
Stop bit 1
Environment C#/ASP.net 4.5
USB port
Code

private void Form1_Load(object sender, EventArgs e)
{
RFID = new SerialPort();
RFID.PortName = "COM3";
RFID.BaudRate = 9600;
RFID.DataBits = 8;
RFID.Parity = Parity.None;
RFID.StopBits = StopBits.One;
RFID.Open();
RFID.ReadTimeout = 2000;
if (RFID.IsOpen)
{
DispString = "";
txtAccessCardNo.Text = "";
}
else
{
RFID.Close();
}
RFID.DataReceived += new SerialDataReceivedEventHandler(RFID_DataReceived);
}
private void RFID_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
if (txtAccessCardNo.Text.Length >= 12)
{
RFID.Close();
}
else
{
DispString = RFID.ReadExisting();
this.Invoke(new EventHandler(DisplayText));
}
}
private void DisplayText(object sender, EventArgs e)
{
txtAccessCardNo.AppendText(DispString);
}

Please help me Thanks in advance...
anshumandas 13-Jun-16 23:15pm View    
Deleted
I am also using this code but the delegate is not reading the card and not showing any data in the text box.I am using the following configuration:
Port No : Com3
Baud Rate: 9600
Parity None
Data Bit 8
Stop bit 1
Environment C#/ASP.net 4.5
Code

private void Form1_Load(object sender, EventArgs e)
{
RFID = new SerialPort();
RFID.PortName = "COM3";
RFID.BaudRate = 9600;
RFID.DataBits = 8;
RFID.Parity = Parity.None;
RFID.StopBits = StopBits.One;
RFID.Open();
RFID.ReadTimeout = 2000;
if (RFID.IsOpen)
{
DispString = "";
txtAccessCardNo.Text = "";
}
else
{
RFID.Close();
}
RFID.DataReceived += new SerialDataReceivedEventHandler(RFID_DataReceived);
}
private void RFID_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
if (txtAccessCardNo.Text.Length >= 12)
{
RFID.Close();
}
else
{
DispString = RFID.ReadExisting();
this.Invoke(new EventHandler(DisplayText));
}
}
private void DisplayText(object sender, EventArgs e)
{
txtAccessCardNo.AppendText(DispString);
}

Please help me Thanks in advance...