help with keypress enter...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jolace
    New Member
    • Apr 2007
    • 16

    help with keypress enter...

    Please help me with enter.. :) I like when i'm enter value on 1 text box,and when i press enter to go on second text box and when i write value i like to press again enter key and txt3.text=val(t xt1.text)*val(t xt2.text)... Please help me what i must write in code for this
  • SammyB
    Recognized Expert Contributor
    • Mar 2007
    • 807

    #2
    Originally posted by Jolace
    Please help me with enter.. :) I like when i'm enter value on 1 text box,and when i press enter to go on second text box and when i write value i like to press again enter key and txt3.text=val(t xt1.text)*val(t xt2.text)... Please help me what i must write in code for this
    What VB are you using? VBA (if so, for what application), VB6.0, or VB.NET?

    Comment

    • iburyak
      Recognized Expert Top Contributor
      • Nov 2006
      • 1016

      #3
      I assume you use VB6 if not adjust this code:


      [PHP]Option Explicit

      Private Sub Text1_KeyPress( KeyAscii As Integer)
      If KeyAscii = 13 Then
      KeyAscii = 0
      Text2.SetFocus
      End If
      End Sub


      Private Sub Text2_KeyPress( KeyAscii As Integer)
      If KeyAscii = 13 Then
      KeyAscii = 0
      Text3.Text = Val(Text1.Text) * Val(Text2.Text)
      End If
      End Sub[/PHP]

      Comment

      • Jolace
        New Member
        • Apr 2007
        • 16

        #4
        Originally posted by iburyak
        I assume you use VB6 if not adjust this code:


        [PHP]Option Explicit

        Private Sub Text1_KeyPress( KeyAscii As Integer)
        If KeyAscii = 13 Then
        KeyAscii = 0
        Text2.SetFocus
        End If
        End Sub


        Private Sub Text2_KeyPress( KeyAscii As Integer)
        If KeyAscii = 13 Then
        KeyAscii = 0
        Text3.Text = Val(Text1.Text) * Val(Text2.Text)
        End If
        End Sub[/PHP]
        Well Thanky for this but i try and it not work again... if you have some another sugestion please write me i'm waiting..

        Comment

        • Jolace
          New Member
          • Apr 2007
          • 16

          #5
          Originally posted by SammyB
          What VB are you using? VBA (if so, for what application), VB6.0, or VB.NET?
          i'm working in VB 6

          Comment

          • vijaydiwakar
            Contributor
            • Feb 2007
            • 579

            #6
            Originally posted by iburyak
            I assume you use VB6 if not adjust this code:


            [PHP]Option Explicit

            Private Sub Text1_KeyPress( KeyAscii As Integer)
            If KeyAscii = 13 Then
            KeyAscii = 0
            Text2.SetFocus
            End If
            End Sub


            Private Sub Text2_KeyPress( KeyAscii As Integer)
            If KeyAscii = 13 Then
            KeyAscii = 0
            Text3.Text = Val(Text1.Text) * Val(Text2.Text)
            End If
            End Sub[/PHP]
            what's the problem in the code?

            Comment

            • Jolace
              New Member
              • Apr 2007
              • 16

              #7
              Originally posted by vijaydiwakar
              what's the problem in the code?
              well go on next text box but (txt3.text) but not show value for txt2.text * txt1.text

              Comment

              • vijaydiwakar
                Contributor
                • Feb 2007
                • 579

                #8
                Originally posted by Jolace
                well go on next text box but (txt3.text) but not show value for txt2.text * txt1.text
                Not Cleared......?

                Comment

                • Jolace
                  New Member
                  • Apr 2007
                  • 16

                  #9
                  i dont know how to tell you...in first form.. I have 1 combo box and 3 text boxes and one button. first text box is for const which i choose from combobox and second is for my value... when i press enter go on first to second text box but when i press enter again go on textbox 3 which i like to be protected and when i press enter automatic show value for txt1 * txt2 ... Do you anderstand me... for key enter i'm writing this..
                  Private Sub Form_KeyPress(K eyAscii As Integer)
                  If KeyAscii = 13 Then
                  SendKeys "{TAB}"
                  KeyAscii = 0
                  End If
                  End Sub

                  Comment

                  • vijaydiwakar
                    Contributor
                    • Feb 2007
                    • 579

                    #10
                    Originally posted by Jolace
                    i dont know how to tell you...in first form.. I have 1 combo box and 3 text boxes and one button. first text box is for const which i choose from combobox and second is for my value... when i press enter go on first to second text box but when i press enter again go on textbox 3 which i like to be protected and when i press enter automatic show value for txt1 * txt2 ... Do you anderstand me... for key enter i'm writing this..
                    Private Sub Form_KeyPress(K eyAscii As Integer)
                    If KeyAscii = 13 Then
                    SendKeys "{TAB}"
                    KeyAscii = 0
                    End If
                    End Sub
                    make keypreview of form to true
                    then use the multiplication code in text3 validate event

                    Comment

                    Working...