473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

converting from TextBox1.Text to Byte()

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
Jan 10 '06 #1
2 1507
Jason,

That needs no snippet, the text.encoding class is complete for that.

http://msdn2.microsoft.com/en-us/lib....getbytes.aspx

I hope this helps,

Cor
Jan 10 '06 #2
"Jason" <ja***@acd.net> schrieb:
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'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Chris Online | last post by:
Hi all, I'm using C++ Builder5. I want to get data from an edit-box and send it to a development kit. The dev-kit can only receive char and no char* here's a part of my code: char* Data_byte...
3
by: Max Gattringer | last post by:
I have written a little programm, which converts normal Text into Unicode Bytes - nothing special, but i tried to creat 2nd Encoder which converts strings(numbers) in a textBox (strings which i...
8
by: Brian Conway | last post by:
How do I convert a field that is filled in to uppercase within the C3 code? I see the ToUpper in there, but how do I get the text box to convert this to upper when you change focus or move to...
4
by: Prabhu | last post by:
Hi, We are having problem in converting a byte array to string, The byte array has char(174), char(175), char(240), char(242) and char(247) as delimiters for the message. when we use...
6
by: Manish | last post by:
In my application there is need for only upper case chars.. Currently I am making entry to upper case when user leaves focus of the text control. I want to do some modification here...When user...
4
by: Chris242 | last post by:
Hey guys I have written a small application that will send keys from the keyboard depending on the users input. My thing is I can't use SendKeys.Send because i need to emulate the keyboard...
11
by: Nathan Sokalski | last post by:
I add several JavaScript events (onchange, onkeypress, etc.) to Controls using the Add method of the Attributes collection. However, if the JavaScript code contains certain characters, such as & or...
3
by: Mark Ivey | last post by:
VS.Net 2002 - Visual Basic I am pretty new to VB in general, and I am having a bit of difficulty finding the right method or property to link a textbox to a filelistbox. Here is the...
1
by: vcbytes | last post by:
I am having a problem with the following code: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { String^ texts = textBox1->Text; char *text =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.