Monday, May 4, 2009

Reading COM port ( barcode scanner)

I used this code to read from the barcode scanner...

private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
Invoke(new EventHandler(AddRecieve));
}
string check5;

private void AddRecieve(object s, EventArgs e)
{
check5 = string.Empty;
check5 = serialPort1.ReadLine();
try
{
// use your code here for validations and other
}
}

No comments:

Post a Comment