I just have an assignment that tells me to do the following things.
Create a button. When that button is clicked, an InputBox will appear to let the user enter a word or phrase.
Then, there are 2 radio buttons: Encode & Decode
When Encode is checked "True", the label should display the "binary integer for each letter in the InputBox, including the space.
When Decode is checked "True", the label should convert the "binary integer" back into the original word or phrase that the user first enters.
Here's my code so far, and it does work:
Public Class Form1 Public strstore As String Private Sub btnenter_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnenter.Click Dim strenter As String strenter = InputBox("Enter a word or phrase:") strstore = strenter End Sub Private Sub radencode_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles radencode.Click If radencode.Checked = True Then Dim Letters = From c As Char In strstore.ToCharArray Select AscW(c) & " " Me.lblanswer.Text = String.Join("", Letters.ToArray) End If End Sub Private Sub raddecode_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles raddecode.Click If raddecode.Checked = True Then Me.lblanswer.Text = strstore End If End Sub End Class
But then, part B of the assignment says: Create another button. When the button is clicked, 2 will be added to every "binary integer", except for the space, whose binary code is "32". After that, convert those series of "updated binary integer" back into a word or phrase.
How can I do this?
Edited 6 Years Ago by __avd: Added [code] tags. Encase your code in: [code] and [/code] tags.