Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

tutorial 9 visual basic set text to ASCII code and ASCII code to text

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
208 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Nov 1, 2011

in this tutorial i will show you how to create a form to set a text into the ASCII code and an ASCII code to the text

dutch technology site + forum: http://technetforum.tk/
codes:
set text to code
Dim Val As String = Nothing Dim Result As New System.Text.StringBuilder For Each Character As Byte In System.Text.ASCIIEncoding.ASCII.GetBytes(RichTextBox1.Text) Result.Append(Convert.ToString(Character, 2).PadLeft(8, "0")) Result.Append(" ") Next Val = Result.ToString.Substring(0, Result.ToString.Length - 1) RichTextBox2.Text = Val
set code to text
Dim Val As String = Nothing Dim Characters As String = System.Text.RegularExpressions.Regex.Replace(RichTextBox2.Text, "[^01]", "") Dim ByteArray((Characters.Length / 8) - 1) As Byte For Index As Integer = 0 To ByteArray.Length - 1 ByteArray(Index) = Convert.ToByte(Characters.Substring(Index * 8, 8), 2) Next Val = System.Text.ASCIIEncoding.ASCII.GetString(ByteArray) RichTextBox1.Text = Val
save code
Dim SaveFileDialog1 As New SaveFileDialog SaveFileDialog1.Filter = "Rich Text Files(*.rtf)|*.rtf|All files (*.*)|*.*" SaveFileDialog1.ShowDialog() FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output) PrintLine(1, RichTextBox2.Text) FileClose(1)

save text

Dim SaveFileDialog1 As New SaveFileDialog SaveFileDialog1.Filter = "Rich Text Files(*.rtf)|*.rtf|All files (*.*)|*.*" SaveFileDialog1.ShowDialog() FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output) PrintLine(1, RichTextBox1.Text) FileClose(1)
open code
Dim OpenFileDialog1 As New OpenFileDialog Dim AllText As String = "", LineOfText As String = "" OpenFileDialog1.Filter = "All Files|*.*" OpenFileDialog1.ShowDialog() Try FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input) Do Until EOF(1) LineOfText = LineInput(1) AllText = AllText & LineOfText & vbCrLf Loop RichTextBox2.Text = AllText Catch Finally FileClose(1) End Try
open text
Dim OpenFileDialog1 As New OpenFileDialog Dim AllText As String = "", LineOfText As String = "" OpenFileDialog1.Filter = "All Files|*.*" OpenFileDialog1.ShowDialog() Try FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input) Do Until EOF(1) LineOfText = LineInput(1) AllText = AllText & LineOfText & vbCrLf Loop RichTextBox1.Text = AllText Catch Finally FileClose(1) End Try

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (0)

Sign In or Sign Up now to post a comment!
Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more