How to decode Base64 to original String?

How To Convert ASCII To String In Visual Basic.?

  • I've found how to convert text entered to ASCII, but I cant seem to find how to decode the numbers. Heres my code(this is in the VB5 & 6 Textbook): Private strText As String Private strConvertedText As String Private strConvertedAscii As String 'Ends the program Private Sub cmdDone_Click() End End Sub 'Sets both options un checked on form start up Private Sub Form_Load() optEncode.Value = False optDecode.Value = False End Sub Private Sub optDecode_Click() End Sub 'Converts text the user entered, to ASCII code Private Sub optEncode_Click() Dim strText As String Dim strCurrentLetter As String Dim intLength As Integer Dim strConvertedText As String strText = txtText.Text For intLength = 1 To Len(strText) strCurrentLetter = Mid(strText, intLength, 1) Debug.Print strCurrentLetter strConvertedText = strConvertedText & Asc(strCurrentLetter) & " " Debug.Print strConvertedText Next intLength lblFinal.Caption = strConvertedText End Sub I need someone to give me the code for the optDecode option.

  • Answer:

    The following code works. 'Ends the program Private Sub cmdDone_Click() End End Sub Dim strText As String 'Dim strConvertedText As String Dim strConvertedAscii As String Private Sub Label1_Click() End Sub Private Sub optDecode_Click() Dim strDecoded As String Dim Str1, Str2 As String Dim Flag1, Cnt As Integer Do While Flag1 = 0 Flag1 = 1 Cnt = Cnt + 1 If Mid(lblFinal.Caption, Cnt, 1) <> " " Then Str1 = Str1 & Mid(lblFinal.Caption, Cnt, 1) Flag1 = 0 Else Str2 = Str2 & Chr(Val(Str1)) If Cnt < Len(lblFinal.Caption) Then Flag1 = 0 Str1 = " " End If End If Loop lblDecoded.Caption = Str2 End Sub 'Converts text the user entered, to ASCII code Private Sub optEncode_Click() Dim strText As String Dim strCurrentLetter As String Dim intLength As Integer Dim strConvertedText As String strText = txtText.Text For intLength = 1 To Len(strText) strCurrentLetter = Mid(strText, intLength, 1) Debug.Print strCurrentLetter strConvertedText = strConvertedText & Asc(strCurrentLetter) & " " Debug.Print strConvertedText Next intLength lblFinal.Caption = strConvertedText End Sub 'Sets both options un checked on form start up Private Sub Form_Load() optEncode.Value = False optDecode.Value = False End Sub TexMav

Jonathan at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.