PDA

Click to See Complete Forum and Search --> : Help Keypress


Coco_Nutty
Jan 24th, 2000, 04:20 PM
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

RogerH
Jan 24th, 2000, 07:16 PM
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).]

Coco_Nutty
Jan 25th, 2000, 04:12 AM
Thanks, but it still will not let me enter anything into the first Text1(txtOne)