954,559 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Very Simple Code Not Working !

Hi I am new to VB but I was trying to just make a program so that if you press the letter A on your keyboard the text in a textbox is added to 1 (it starts at 0).... I'm using vb 2008 express edition.

Public Class Form1



    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If e.KeyCode = Keys.A Then
            TextBox1.Text = TextBox1.Text + 1

        End If
    End Sub


End Class


I put a textbox (1) in my form but when i press run, the "cursor" is in the textbox so if i press A the thing changes to the letter a since my text cursor is in the box. Basically it doesnt work!!! HELP PLEASE!

salman213
Light Poster
32 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

Move to vb.net forum. well.. try to look at here for the solution

jireh
Posting Whiz
316 posts since Jul 2007
Reputation Points: 11
Solved Threads: 49
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You