GXDN: Gurux Developer Network
ReceivedEventHandler Delegate
NamespacesGurux.TerminalReceivedEventHandler
GXTerminal component sends received data through this method.
Parameters
sender (Object)
The source of the event.
data (array< Byte >[]()[])
Byte buffer (variant array) containing the received data.
senderInfo (String)
Serial port number.
Examples
CopyC#
                /// <summary>
/// Show received data.
/// </summary>
/// <param name="sender"></param>
/// <param name="Data"></param>
/// <param name="SenderInfo"></param>
private void gxTerminal1_OnReceived(object sender, byte[] Data, string SenderInfo)
{
    try
    {
        //We receive byte array from GXSerial and this must be changed to chars.
        if (HexCB.Checked)
        {
            ReceivedText.Text += BitConverter.ToString(Data);
        }
        else
        {
            //Get received data as string.
            ReceivedText.Text += System.Text.Encoding.ASCII.GetString(Data);
        }
    }
    catch (Exception Ex)
    {
        MessageBox.Show(Ex.Message);

    }
}
CopyVB.NET
                ''' <summary>
''' Show received data.
''' </summary>
Private Sub GxTerminal1_OnReceived(ByVal sender As System.Object, ByVal Data() As System.Byte, ByVal SenderInfo As System.String) Handles GxTerminal1.OnReceived
    Try
        Dim Value As Byte()
        Value = Data
        'We receive byte array from GXSerial and this must be changed to chars.
        If (HexCB.Checked) Then
            ReceivedText.Text += BitConverter.ToString(Value)
        Else
            'Get received data as string.
            ReceivedText.Text += System.Text.Encoding.ASCII.GetString(Value)
        End If
    Catch Ex As Exception
        MessageBox.Show(Ex.Message)
    End Try
End Sub
CopyVBScript
                'New data from GXTerminal is received
Private Sub GXTerminal1_OnReceived(ByVal sender As Object, var As Variant, ByVal SenderInfo As String)
On Error GoTo GXErr
    'We receive byte array from GXTerminal and this must be changed to chars.
    Dim ch As String
    Dim a As Long
    For a = 0 To UBound(var)
        'Convert byte to chr
        ch = Chr(var(a))
        ReceivedText.Text = ReceivedText.Text + ch
    Next
    Exit Sub
GXErr:
    MsgBox Err.Description
End Sub
See Also

Assembly: Gurux.Terminal (Module: Gurux.Terminal) Version: 5.0.0.1