converting from TextBox1.Text to Byte()

J

Jason

Hi.

Does anyone have a snippet of code that will convert a character string to a
byte array? I've nearly smashed my head against the wall trying to figure
this out.

I'm Using vb.net 2003

The problem that I am running into is that System.Type.GetType("Byte")
returns null. Anybody know why? I've tried code similiar to the following
to achieve my results:

Dim theCommand as New ArrayList
For each c as Char in InputTextBox.Text.ToCharArray()
theCommand.Add(c)
Next
Dim TempArray as Byte()
TempArray = theCommand.ToArray(System.Type.GetType("Byte"))
' The above line should give me a byte array of the previous text, but
instead it just errors saying that System.Type.GetType("Byte")) is null

Any Ideas?

Thanks in advance,

-- Jason
 
H

Herfried K. Wagner [MVP]

Jason said:
Does anyone have a snippet of code that will convert a character string to
a
byte array? I've nearly smashed my head against the wall trying to figure
this out.

'System.Text.Encoding.<encoding>.GetBytes'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top