Very Simple Code Not Working !

Reply

Join Date: Jun 2008
Posts: 32
Reputation: salman213 is an unknown quantity at this point 
Solved Threads: 0
salman213 salman213 is offline Offline
Light Poster

Very Simple Code Not Working !

 
0
  #1
Jan 21st, 2009
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!
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 300
Reputation: jireh is an unknown quantity at this point 
Solved Threads: 42
jireh's Avatar
jireh jireh is offline Offline
Posting Whiz

Re: Very Simple Code Not Working !

 
0
  #2
Jan 21st, 2009
Move to vb.net forum. well.. try to look at here for the solution
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC