GXDialUp component sends received data through this method.
/// <summary>
/// Show received data.
/// </summary>
/// <param name="sender"></param>
/// <param name="Data"></param>
/// <param name="SenderInfo"></param>
private void gxDialUp1_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((byte[]) Data);
}
else
{
//Get received data as string.
ReceivedText.Text += System.Text.Encoding.ASCII.GetString((byte[]) Data);
}
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
}
''' <summary>
''' Show received data.
''' </summary>
Private Sub GxDialUp1_OnReceived(ByVal sender As System.Object, ByVal Data() As System.Byte, ByVal SenderInfo As System.String) Handles GxDialUp1.OnReceived
Dim Value As Byte()
Value = Data
'We receive byte array from GXDialUp and this must be changed to chars.
If (HexCB.Checked) Then
ReceivedText.Text += BitConverter.ToString(Data)
Else
'Get received data as string.
ReceivedText.Text += System.Text.Encoding.ASCII.GetString(Data)
End If
End Sub
'New data from GXDialUp is received
Private Sub GXDialUp1_OnReceived(ByVal sender As Object, Data As Variant, ByVal SenderInfo As String)
'We receive byte array from GXDialUp and this must be changed to chars.
Dim pos As Long, ch As String
For pos = 0 To UBound(Data)
If HexCB.Value = 1 Then
'Show as hex
ReceivedText.Text = ReceivedText.Text & Hex(Data(pos)) & " "
Else
'Convert byte to chr
ch = Chr(Data(pos))
ReceivedText.Text = ReceivedText.Text + ch
End If
Next
End Sub
Assembly: Gurux.DialUp (Module: Gurux.DialUp) Version: 5.0.0.1