By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,967 Members | 2,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,967 IT Pros & Developers. It's quick & easy.

keystroke

OuTCasT
100+
P: 374
how does one add up a total of textboxes using the enter keystroke to display the total in a label
Apr 10 '08 #1
Share this Question
Share on Google+
4 Replies


100+
P: 133
how does one add up a total of textboxes using the enter keystroke to display the total in a label
what version ov visual basics are you using ?

GobbleGob.
Apr 10 '08 #2

OuTCasT
100+
P: 374
what version ov visual basics are you using ?

GobbleGob.
I am using Visual Studio 2008.
what i want is jst to type in a value in the first textbox and when i press enter the label must hld that value and then if i add a value to the second textbox then they are added up and the label hold the value
Apr 10 '08 #3

debasisdas
Expert 5K+
P: 8,127
Try handling the keycode 13.
Apr 10 '08 #4

jamesd0142
100+
P: 469
Expand|Select|Wrap|Line Numbers
  1.  Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
  2.  
  3.         If Asc(e.KeyChar) = 13 Then
  4.             add()
  5.         End If
  6.     End Sub
  7.  
  8.     Private Sub add()
  9.         Try
  10.             Label1.Text = CInt(Label1.Text) + CInt(TextBox1.Text)
  11.         Catch
  12.         End Try
  13.     End Sub
  14.  
Apr 10 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.