gives 65 rather than A, so what's the neatest way to convert c to be seen as a character in that context? I must admit I have encountered such situations myself at times and have dealt with them by just doing things a different way to begin with, but I don't know that the results look too neat.
Yes that does do the job, thanks, but I guess it highlights the problems I have trying to understand when strings are interchangeable with byte arrays. I had in fact tried the below, since my thoughts were that such a char function would be expected to return a string type:
private Sub char(b As Byte) As String
Dim a As String = Array As Byte(b)
Of course the IDE throws up a warning #7 at line 2 about object being converted to a string as being perhaps a programming mistake, but if a string is a byte array then why so? The result from this was not 65 nor A but 1073741648
I do understand that a string is fundamentally held as an array (or you might even say string ) of bytes with the last byte having a value 0, but in my example if the string 'a' is just rendered into an array of bytes (my interpretation of the word 'cast') then it would be as if 'a' is just the same as array of bytes(65,0). However this doesn't appear to be exactly the case since:
Dim e() As Byte = Array As Byte(65,0)
returns an 'A', whereas my sub doesn't. So it must mean that at least the log function treats the return from my sub differently than just an array of bytes. I have indeed read the tutorial on Strings and Bytes in the past but still not quite understanding why the above subtleties are so. Anyhow it's just another one of those curiosities of mine