Data lost?

I have used Vacomm and when I receive the data I display on VaTerminal. ok
But when I place this code
void __fastcall TForm8::cncCommRxBuf(TObject *Sender, PVaData Data, int Count)
{
  int i=cncComm->ReadBuf(&DatiRxCNC[pos],Count);
}
the data received is less then transmitted.
how is possible?
Thanks
Fabio

Most likely, the event handler is triggered before all data is received. This event is triggered as soon as some data is received. Loop to wait for all data is received if you want to fetch all data from this event.

Ok , but why I insert the code in the terminal I lost many chars?

If you configured a VaTerminal for VaComm, the terminal will receive the data. Data received by the terminal will not be received in another way. Data can only be received once.

Ok, I have placed the code on the VaTerminal1DataReceived event.
But It's the same...
Do you have an example that explain the ReadBuf method?
Thanks
Fabio

Are you waiting long enough till ALL data can be received?

I cannot to wait inside an event handler...
And I receive the 2nd char only inside .
It's correct the code inside event handler?

Do you have an example to explain how to use VaTerminal DataReceived  handler?
Thanks
Fabio

When I insert on the DataReceived handler this code
..
 int i=cncComm->ReadBuf(&DatiRxCNC[pos],Count);
..
I loss many chars.
When I surround this, not!
Why?
Thanks
Fabio

The data returned in OnDataReceived is passed via the parameter PVaData. The number of bytes received is Count. You should NOT perform ReadBuf() from this event but check the PVaData parameter. When you call ReadBuf(), this retrieves characters directly from vaComm bypassing TVaTerminal.