Results 1 to 3 of 3

Thread: Help Keypress

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    BC
    Posts
    11

    Post

    Private Sub Form_Load()
    txtTwo.Visible = False
    lblTwo.Visible = False
    txtOne.Text = ""
    lblOne.Caption = "Place entry here"

    End Sub


    Private Sub txtOne_GotFocus()

    txtOne.SelLength = Len(txtOne.Text)
    End Sub

    Private Sub txtOne_KeyPress(keyascii As Integer)
    If keyascii = vbKeyReturn Then

    txtTwo.Visible = True
    lblTwo.Visible = True
    txtOne.Visible = False
    lblOne.Visible = False
    lblTwo.Caption = "Now place entry here"

    Else
    txtTwo.ForeColor = vbBlue

    End If
    keyascii = 0
    End Sub


    The code above is giving me the worst trouble.When I load my form txtTwo and lblTwo are hidden like I want but I am unable to enter anything into form one txtOne when the form originaly loads.
    Buy the way could it be because I have made the enter key my keyPress.

    Thanks
    Coco_Nutty

  2. #2
    Lively Member
    Join Date
    Dec 1999
    Location
    Karlsruhe, Germany
    Posts
    122

    Post

    You always set keyascii to 0. Put the code line

    keyascii = 0

    inside the "If .. End if" statement.

    [This message has been edited by RogerH (edited 01-25-2000).]

    [This message has been edited by RogerH (edited 01-25-2000).]

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    BC
    Posts
    11

    Post

    Thanks, but it still will not let me enter anything into the first Text1(txtOne)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width