E Electrocutioner Member Licensed User Longtime User Nov 10, 2012 #1 The following code gives Cannot cast type error: Please help thanks! Sub btnON_Click Dim buffer As String buffer="test" AStream.Write(buffer) End Sub
The following code gives Cannot cast type error: Please help thanks! Sub btnON_Click Dim buffer As String buffer="test" AStream.Write(buffer) End Sub
mc73 Well-Known Member Licensed User Longtime User Nov 11, 2012 #2 Try this: Code: Copy dim testString as String testString="test" Dim buffer() As Byte buffer=testString.GetBytes("UTF8") AStream.Write(buffer) Upvote 0
Try this: Code: Copy dim testString as String testString="test" Dim buffer() As Byte buffer=testString.GetBytes("UTF8") AStream.Write(buffer)
merlin2049er Well-Known Member Licensed User Longtime User Aug 23, 2013 #3 Nice example. If your sending strings to another android device, how would the other side know what to do with it? I guess I can use prefix before the actual string. if you want to send label1.text = "something" and show up on the other android device as label1.text= "something" Code: Copy dim label1 asString label1 = "label1" & label1.text Dim buffer() AsByte buffer=label1.GetBytes("UTF8") AStream.Write(buffer) on the other end when you receive the string check the prefix to know where it goes, then strip the prefix. Upvote 0
Nice example. If your sending strings to another android device, how would the other side know what to do with it? I guess I can use prefix before the actual string. if you want to send label1.text = "something" and show up on the other android device as label1.text= "something" Code: Copy dim label1 asString label1 = "label1" & label1.text Dim buffer() AsByte buffer=label1.GetBytes("UTF8") AStream.Write(buffer) on the other end when you receive the string check the prefix to know where it goes, then strip the prefix.