View Full Version : Which Event?


agehoops
07-11-2007, 07:04 AM
Which Event do I need to use to check what the user is typing into a box as they are typing it? Have tried using a timer that is activated at a certain point, however it still only checks it once the user clicks out of the control.

Thanks

KeithG
07-11-2007, 07:16 AM
So you want to check the value of the control after each keystroke? Use the On_Key up event.

If you want to check which indivdual key was pressed use the keypress event.

agehoops
07-11-2007, 07:19 AM
hmm still not really working properly. Yea I want it to simply check the text in the text box after every stroke. I'm using the following code in the Key_Up event now.

If InStr([txtSendTo], "@") <> 0 And InStr([txtSendTo], ".") <> 0 Then
txtMessageSubject.Visible = True
txtMessageText.Visible = True
lblInstructions.Caption = "Please Enter a Subject and Message For The Email, Then Click Send."
cmdSend.Visible = True
chkStatus.Visible = True
txtStatus.Visible = True
Else
lblInstructions.Caption = "You Must Include an '@' Symbol and a Full Stop (.) To Proceed."
txtMessageSubject.Visible = False
txtMessageText.Visible = False
cmdSend.Visible = False
chkStatus.Visible = False
txtStatus.Visible = False
End If

KeithG
07-11-2007, 07:39 AM
You are not referencing the control correctly. It should be
me.txtSendTo.text

The Text property will show you the uncommited value of the control, the Value property will show you the commited value of the control

agehoops
07-11-2007, 07:43 AM
ah ok that makes sense. Works perfectly now. Thanks :D