Solved

How convert text string to asc text in vb.net2010

Posted on 2011-09-15
4
394 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 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