How To Make A Text To Binary Converter In VB.NET



hey guys and girls today i am going to teach you how to make a binary to text converter or binary to text converter in vb.net simply you dont have to waste much time in this tutorials . first of all you should have known what is binary so take a look at this page and come back ok now i will explain how this works . you have two text box and you have two buttons now you need to add text in text box1 and click button1 to convert your text box1 text to binary and the binary code for the text will be shown in text box2 ok so lets make it now create a new project and add two text box and two buttons and change the button1 text to convert to binary and change the button2 to convert to text and dont forget text box is for text and text box2 is for binary . i can say make your application look like this




now time for coding , go to codes and add this

Public Class Form1

    'Author : Mohamed Shimran
    'Blog : http://www.ultimateprogrammingtutorials.blogspot.com

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Value As String = Nothing
        Dim Re As New System.Text.StringBuilder
            For Each Character As Byte In System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox1.Text)
            Re.Append(Convert.ToString(Character, 2).PadLeft(8, "0"))
            Re.Append(" ")
            Next
        Value = Re.ToString.Substring(0, Re.ToString.Length - 0)
        TextBox2.Text = Value

    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
       
            TextBox1.Text = TextBox2.Text
        Dim Values As String = Nothing
        Dim Character As String = System.Text.RegularExpressions.Regex.Replace(TextBox1.Text, "[^01]", "")
        Dim ByteArrays((Character.Length / 8) - 1) As Byte
        For Index As Integer = 0 To Bytearrays.Length - 1
            Bytearrays(Index) = Convert.ToByte(Character.Substring(Index * 8, 8), 2)
        Next
        Values = System.Text.ASCIIEncoding.ASCII.GetString(Bytearrays)
        TextBox2.Text = Values

    End Sub
End Class


now test it


5 comments

Thanks for sharing binary converter. Good suggestion.

Reply

Nice tips for converting text to binary converter in vb.net. This is really helpful for me.

Reply

Certainly, if you are working with sixty 2nd selections, this may not be possible along with you have to stay with on-line notifies. Using for a longer time duration, such as a day time or maybe a full week, TXT notifies may be a good binary matrix pro.

Reply

I tried it with Visual Studio Basic
but it says error: ">" expected.
Says that for the word CLASS at the <span class

Reply

Good post.Thank you so much for sharing this post.WhatsApp++ Pokemon Go++ Instagram++

Reply

Post a Comment

Note: Only a member of this blog may post a comment.