Solved

How convert text string to asc text in vb.net2010

Posted on 2011-09-15
4
390 Views
Last Modified: 2012-05-12
eg. a="202020" need to convert to "   "

May I know how to make it, thanks.
0
Comment
Question by:turbot_yu
  • 2
4 Comments
 
LVL 8

Expert Comment

by:guvera
ID: 36547375
Hi,

 Please try the below code.

        Dim strSource As String
        Dim bteEndode() As Byte
        Dim myFileStream As New FileStream("test.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite)


        strSource = "asdf"
        bteEndode = Encoding.ASCII.GetBytes(strSource)
 
       
        myFileStream.Write(bteEndode, 0, bteEndode.Length)
 
        myFileStream.Close()

Hope it may helpful to you.

Regards
Guvera
0
 
LVL 8

Assisted Solution

by:guvera
guvera earned 100 total points
ID: 36547378
Also please find the below link for more details about this query.

 http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx

Regards
Guvera
0
 
LVL 2

Accepted Solution

by:
ASP8MBM earned 400 total points
ID: 36547427
hope this helps:

        Dim arrByte As Byte() = Encoding.ASCII.GetBytes(TextBox1.Text)
        Dim strSB As New StringBuilder

        For Each bite As Byte In arrByte
            strSB.Append(bite & " "c)
        Next
        TextBox2.Text = strSB.ToString
0
 

Author Comment

by:turbot_yu
ID: 36547485
it is now already convert to "533132333435363741202020" in string(by Hex(abNum(i))), I need to convert it back to "abc.....".
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now