• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 399
  • Last Modified:

How convert text string to asc text in vb.net2010

eg. a="202020" need to convert to "   "

May I know how to make it, thanks.
0
turbot_yu
Asked:
turbot_yu
  • 2
2 Solutions
 
guveraCommented:
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
 
guveraCommented:
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
 
ASP8MBMCommented:
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
 
turbot_yuAuthor Commented:
it is now already convert to "533132333435363741202020" in string(by Hex(abNum(i))), I need to convert it back to "abc.....".
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now