keystroke

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • OuTCasT
    Contributor
    • Jan 2008
    • 374

    keystroke

    how does one add up a total of textboxes using the enter keystroke to display the total in a label
  • gobblegob
    New Member
    • Dec 2007
    • 133

    #2
    Originally posted by OuTCasT
    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.

    Comment

    • OuTCasT
      Contributor
      • Jan 2008
      • 374

      #3
      Originally posted by gobblegob
      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

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Try handling the keycode 13.

        Comment

        • jamesd0142
          Contributor
          • Sep 2007
          • 471

          #5
          [code=text]
          Private Sub TextBox1_KeyPre ss(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles TextBox1.KeyPre ss

          If Asc(e.KeyChar) = 13 Then
          add()
          End If
          End Sub

          Private Sub add()
          Try
          Label1.Text = CInt(Label1.Tex t) + CInt(TextBox1.T ext)
          Catch
          End Try
          End Sub
          [/code]

          Comment

          Working...