I am trying to fetch value from PORT where I attached hardware.I am successfully getting value from port but when I am trying to fill this value it gives following error
"the calling thread cannot access this object because a different thread owns it"
here is my code
private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
try
{
string strAck = port.ReadExisting();
if (!string.IsNullOrWhiteSpace(strAck))
{
txtvalue = strAck;
}
}
catch(Exception ex)
{
}
}