Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
Dim s As Integer = Convert.ToInt32("A"c)
Dim x() As Integer = StringToWords("ABC")
Dim XasString(x.Length - 1) As String
For i = 0 To x.Length - 1
XasString(i) = CStr(x(i))
Next
OmronEthernetFINSCom1.Write("D10", XasString)
End Sub
Public Shared Function StringToWords(ByVal source As String) As Int32()
If source Is Nothing Then
Return Nothing
' Throw New ArgumentNullException("input")
End If
Dim ArraySize As Integer = Convert.ToInt32(Math.Ceiling(source.Length / 2)) - 1
Dim ConvertedData(ArraySize) As Int32
Dim i As Integer
While i <= ArraySize
ConvertedData(i) = Convert.ToInt32(Convert.ToChar(source.Substring(i * 2, 1))) * 256
'* Check if past last character of odd length string
If (i * 2) + 1 < source.Length Then ConvertedData(i) += Convert.ToInt32(Convert.ToChar(source.Substring((i * 2) + 1, 1)))
i += 1
End While
Return ConvertedData
End Function