943,794 Members | Top Members by Rank

Ad:
Jan 21st, 2009
0

Very Simple Code Not Working !

Expand Post »
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.

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Public Class Form1
  2.  
  3.  
  4.  
  5. Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
  6. If e.KeyCode = Keys.A Then
  7. TextBox1.Text = TextBox1.Text + 1
  8.  
  9. End If
  10. End Sub
  11.  
  12.  
  13. 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!
Reputation Points: 10
Solved Threads: 0
Light Poster
salman213 is offline Offline
32 posts
since Jun 2008
Jan 21st, 2009
0

Re: Very Simple Code Not Working !

Move to vb.net forum. well.. try to look at here for the solution
Reputation Points: 11
Solved Threads: 49
Posting Whiz
jireh is offline Offline
316 posts
since Jul 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: please help me for my thesis?
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: VB4 and Windows Vista





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC