Tom,
Remember that ASCII only supports characters 0 to 127, if you want
characters 0 to 255 then you may want to consider using Encoding.Default
instead, which is set to your current Windows Code Page.
There is also Encoding.UTF7 & Encoding UTF8 which will give 1 byte per char,
however they do interesting things with characters 128 to 255...
For a series of links on Unicode, Ascii, Ansi & various encodings used see:
http://www.yoda.arachsys.com/csharp/unicode.html
Hope this helps
Jay
"Tom" <to*@nospam.com> wrote in message
news:eO*************@tk2msftngp13.phx.gbl...
Armin: Cool, thanks! However, I had to use
System.Text.Encoding.ASCII.GetBytes to convert it properly - otherwise, I
was getting a NULL (chr(0)) between each character.
Also, I see that System.Text.Encoding.ASCII.GetChars converts it back to a
string value.
Tom
"Armin Zingler" <az*******@freenet.de> wrote in message
news:40***********************@news.freenet.de... "Tom" <to*@nospam.com> schrieb Stupid Question: Have a string ("ABC"); need to convert that to a
byte array (Dim x(3) as Byte). Do I have to do this manually or is
there a .NET command to do it automatically?
dim x as byte()
x = System.text.encoding.unicode.getbytes("ABC")
converts to a Unicode encoded byte array.
--
Armin
How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html