How to Create a Broken Keys Program in Visual Basic
Submitted by GeePee on Saturday, April 25, 2015 - 23:16.
Introduction:
Welcome to my tutorial on how to create a Broken Keys program in Visual Basic. This program will allow a user with a bad keyboard to easily write a sentance and copy it to their clipboard, ready to paste in to other applications.
Steps of Creation:
Step 1:
First lets create a form with;
button1 - Add the current selection to the text to be copied
button2 - Copy the text to the clipboard
button3 - Go to the next character
Button4 - Go to the previous character
textbox1 - Contain the current text to be copied
label1 - Contain the current character to be added.
Lets also make a current position integer and a list ready to hold our characters.
Step 2:
Next we want to add our possible characters to our character list. We do this on form load so it is ready for us instantly.
Step 3:
The only custom function I have created is to update the label with the current position of characters.
Step 4:
Finally, we want to make the button actions.
Project Complete!
Below is the full source code and download to the project files.
- Dim curPos As Integer = 0
- Dim items As New List(Of String)
- items.Add("A")
- items.Add("B")
- items.Add("C")
- items.Add("D")
- items.Add("E")
- items.Add("F")
- items.Add("G")
- items.Add("H")
- items.Add("I")
- items.Add("J")
- items.Add("K")
- items.Add("L")
- items.Add("M")
- items.Add("N")
- items.Add("O")
- items.Add("P")
- items.Add("Q")
- items.Add("R")
- items.Add("S")
- items.Add("T")
- items.Add("U")
- items.Add("V")
- items.Add("W")
- items.Add("X")
- items.Add("Y")
- items.Add("Z")
- items.Add("a")
- items.Add("b")
- items.Add("c")
- items.Add("d")
- items.Add("e")
- items.Add("f")
- items.Add("g")
- items.Add("h")
- items.Add("i")
- items.Add("j")
- items.Add("k")
- items.Add("l")
- items.Add("m")
- items.Add("n")
- items.Add("o")
- items.Add("p")
- items.Add("q")
- items.Add("r")
- items.Add("s")
- items.Add("t")
- items.Add("u")
- items.Add("v")
- items.Add("w")
- items.Add("x")
- items.Add("y")
- items.Add("z")
- items.Add("1")
- items.Add("2")
- items.Add("3")
- items.Add("4")
- items.Add("5")
- items.Add("6")
- items.Add("7")
- items.Add("8")
- items.Add("9")
- items.Add("0")
- Private Function updateLabel()
- Label1.Text = items(curPos)
- End Function
- Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
- curPos += 1
- updateLabel()
- End Sub
- Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
- curPos -= 1
- updateLabel()
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- My.Computer.Clipboard.Clear()
- My.Computer.Clipboard.SetText(TextBox1.Text)
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- TextBox1.Text &= items(curPos)
- End Sub
- Public Class Form1
- Dim curPos As Integer = 0
- Dim items As New List(Of String)
- Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
- curPos += 1
- updateLabel()
- End Sub
- Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
- curPos -= 1
- updateLabel()
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- My.Computer.Clipboard.Clear()
- My.Computer.Clipboard.SetText(TextBox1.Text)
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- TextBox1.Text &= items(curPos)
- End Sub
- Private Function updateLabel()
- Label1.Text = items(curPos)
- End Function
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- items.Add("A")
- items.Add("B")
- items.Add("C")
- items.Add("D")
- items.Add("E")
- items.Add("F")
- items.Add("G")
- items.Add("H")
- items.Add("I")
- items.Add("J")
- items.Add("K")
- items.Add("L")
- items.Add("M")
- items.Add("N")
- items.Add("O")
- items.Add("P")
- items.Add("Q")
- items.Add("R")
- items.Add("S")
- items.Add("T")
- items.Add("U")
- items.Add("V")
- items.Add("W")
- items.Add("X")
- items.Add("Y")
- items.Add("Z")
- items.Add("a")
- items.Add("b")
- items.Add("c")
- items.Add("d")
- items.Add("e")
- items.Add("f")
- items.Add("g")
- items.Add("h")
- items.Add("i")
- items.Add("j")
- items.Add("k")
- items.Add("l")
- items.Add("m")
- items.Add("n")
- items.Add("o")
- items.Add("p")
- items.Add("q")
- items.Add("r")
- items.Add("s")
- items.Add("t")
- items.Add("u")
- items.Add("v")
- items.Add("w")
- items.Add("x")
- items.Add("y")
- items.Add("z")
- items.Add("1")
- items.Add("2")
- items.Add("3")
- items.Add("4")
- items.Add("5")
- items.Add("6")
- items.Add("7")
- items.Add("8")
- items.Add("9")
- items.Add("0")
- End Sub
- End Class
Add new comment
- 12 views